sqliteman-1.2.2/0000755000175000001440000000000011407213302013112 5ustar subzerouserssqliteman-1.2.2/cmake_uninstall.cmake.in0000644000175000001440000000144411407213302017675 0ustar subzerousersIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) STRING(REGEX REPLACE "\n" ";" files "${files}") FOREACH(file ${files}) MESSAGE(STATUS "Uninstalling \"${file}\"") IF(NOT EXISTS "${file}") MESSAGE(FATAL_ERROR "File \"${file}\" does not exists.") ENDIF(NOT EXISTS "${file}") EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" OUTPUT_VARIABLE rm_out RETURN_VARIABLE rm_retval) IF("${rm_retval}" GREATER 0) MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") ENDIF("${rm_retval}" GREATER 0) ENDFOREACH(file)sqliteman-1.2.2/cmake/0000755000175000001440000000000011407213302014172 5ustar subzerouserssqliteman-1.2.2/cmake/modules/0000755000175000001440000000000011407213302015642 5ustar subzerouserssqliteman-1.2.2/cmake/modules/FindQScintilla.cmake0000644000175000001440000000352011407213302021510 0ustar subzerousers# - Try to find the QScintilla2 includes and library # which defines # # QSCINTILLA_FOUND - system has QScintilla2 # QSCINTILLA_INCLUDE_DIR - where to find qextscintilla.h # QSCINTILLA_LIBRARIES - the libraries to link against to use QScintilla # QSCINTILLA_LIBRARY - where to find the QScintilla library (not for general use) # copyright (c) 2007 Thomas Moenicke thomas.moenicke@kdemail.net # # Redistribution and use is allowed according to the terms of the FreeBSD license. IF(NOT QT4_FOUND) INCLUDE(FindQt4) ENDIF(NOT QT4_FOUND) SET(QSCINTILLA_FOUND FALSE) IF(QT4_FOUND) FIND_PATH(QSCINTILLA_INCLUDE_DIR qsciglobal.h "${QT_INCLUDE_DIR}/Qsci" /usr/include /usr/include/Qsci ) SET(QSCINTILLA_NAMES ${QSCINTILLA_NAMES} qscintilla2 libqscintilla2) FIND_LIBRARY(QSCINTILLA_LIBRARY NAMES ${QSCINTILLA_NAMES} PATHS ${QT_LIBRARY_DIR} ) IF (QSCINTILLA_LIBRARY AND QSCINTILLA_INCLUDE_DIR) SET(QSCINTILLA_LIBRARIES ${QSCINTILLA_LIBRARY}) SET(QSCINTILLA_FOUND TRUE) IF (CYGWIN) IF(BUILD_SHARED_LIBS) # No need to define QSCINTILLA_USE_DLL here, because it's default for Cygwin. ELSE(BUILD_SHARED_LIBS) SET (QSCINTILLA_DEFINITIONS -DQSCINTILLA_STATIC) ENDIF(BUILD_SHARED_LIBS) ENDIF (CYGWIN) ENDIF (QSCINTILLA_LIBRARY AND QSCINTILLA_INCLUDE_DIR) ENDIF(QT4_FOUND) IF (QSCINTILLA_FOUND) IF (NOT QScintilla_FIND_QUIETLY) MESSAGE(STATUS "Found QScintilla2: ${QSCINTILLA_LIBRARY}") MESSAGE(STATUS " includes: ${QSCINTILLA_INCLUDE_DIR}") ENDIF (NOT QScintilla_FIND_QUIETLY) ELSE (QSCINTILLA_FOUND) IF (QScintilla_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find QScintilla library") ENDIF (QScintilla_FIND_REQUIRED) ENDIF (QSCINTILLA_FOUND) MARK_AS_ADVANCED(QSCINTILLA_INCLUDE_DIR QSCINTILLA_LIBRARY) sqliteman-1.2.2/AUTHORS0000644000175000001440000000014111407213302014156 0ustar subzerousersPetr Vanek Original LiteMan author: Igor Khanin igorkh[AT]freeshell[DOT]org sqliteman-1.2.2/sqliteman/0000755000175000001440000000000011407213302015107 5ustar subzerouserssqliteman-1.2.2/sqliteman/createviewdialog.h0000644000175000001440000000174311407213302020603 0ustar subzerousers/* For general Sqliteman copyright and licensing information please refer to the COPYING file provided with the program. Following this notice may exist a copyright and/or license notice that predates the release of Sqliteman for which a new license (GPL+exception) is in place. */ #ifndef CREATEVIEWDIALOG_H #define CREATEVIEWDIALOG_H #include #include "ui_createviewdialog.h" /*! \brief GUI for view creation \author Petr Vanek */ class CreateViewDialog : public QDialog { Q_OBJECT public: CreateViewDialog(const QString & name, const QString & schema, QWidget * parent = 0); ~CreateViewDialog(){}; bool update; void setText(const QString & text) { ui.sqlEdit->setText(text); }; QString schema() { return m_schema; }; QString name() { return m_name; }; private: Ui::CreateViewDialog ui; QString m_schema; QString m_name; private slots: void createButton_clicked(); void nameEdit_textChanged(const QString& text); }; #endif sqliteman-1.2.2/sqliteman/createviewdialog.ui0000644000175000001440000001026211407213302020765 0ustar subzerousers CreateViewDialog 0 0 395 465 Create View 9 6 0 6 Qt::Horizontal 40 20 C&reate 16777215 70 true Qt::Horizontal QDialogButtonBox::Close &Select Statement (AS) 9 6 &Database: databaseCombo &View Name: nameEdit SqlEditorWidget QTextEdit
sqleditorwidget.h
databaseCombo nameEdit sqlEdit createButton resultEdit buttonBox buttonBox accepted() CreateViewDialog accept() 248 254 157 274 buttonBox rejected() CreateViewDialog reject() 316 260 286 274
sqliteman-1.2.2/sqliteman/blobpreviewwidget.cpp0000644000175000001440000000363211407213302021343 0ustar subzerousers/* For general Sqliteman copyright and licensing information please refer to the COPYING file provided with the program. Following this notice may exist a copyright and/or license notice that predates the release of Sqliteman for which a new license (GPL+exception) is in place. */ #include #include #include "blobpreviewwidget.h" BlobPreviewWidget::BlobPreviewWidget(QWidget * parent) : QWidget(parent) { setupUi(this); } void BlobPreviewWidget::setBlobData(QVariant data) { m_data = data.toByteArray(); createPreview(); } void BlobPreviewWidget::createPreview() { QPixmap pm; pm.loadFromData(m_data); if (pm.isNull()) m_blobPreview->setText("" + tr("File content cannot be displayed") + ""); else { // HACK: "-3" constant are there to prevent recursive // growing in Qt events. if (pm.width() > m_blobPreview->width() - 3 || pm.height() > m_blobPreview->height() - 3) { QSize sz(m_blobPreview->size().width()-3, m_blobPreview->size().height()-3); m_blobPreview->setPixmap(pm.scaled(sz, Qt::KeepAspectRatio)); } else m_blobPreview->setPixmap(pm); } m_blobSize->setText(formatSize(m_data.size())); } void BlobPreviewWidget::setBlobFromFile(const QString & fileName) { QFile file(fileName); if (file.open(QIODevice::ReadOnly)) { m_data = file.readAll(); } else m_data = QByteArray(); createPreview(); } void BlobPreviewWidget::resizeEvent(QResizeEvent * event) { createPreview(); QWidget::resizeEvent(event); } QString BlobPreviewWidget::formatSize(qulonglong size/*, bool persec*/) { QString rval; if(size < 1024) rval = QString("%L1 B").arg(size); else if(size < 1024*1024) rval = QString("%L1 KB").arg(size/1024); else if(size < 1024*1024*1024) rval = QString("%L1 MB").arg(double(size)/1024.0/1024.0, 0, 'f', 1); else rval = QString("%L1 GB").arg(double(size)/1024.0/1024.0/1024.0, 0, 'f', 1); // if(persec) rval += "/s"; return rval; } sqliteman-1.2.2/sqliteman/importtabledialog.ui0000644000175000001440000001542611407213302021160 0ustar subzerousers ImportTableDialog 0 0 509 480 Data Import 9 6 &Table to Import Into: tableComboBox &File to Import: fileEdit &Search... 0 Sqlite .import 9 6 Column Separators 9 6 Pipe Symbol (Default) true Comma Semicolon Tabelator 0 6 Custom: Qt::Vertical 20 41 MS Excel XML 9 6 There are no options for this import type. true Preview 9 6 true Qt::Horizontal QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok &Schema to Import: schemaComboBox buttonBox rejected() ImportTableDialog reject() 295 458 286 274 sqliteman-1.2.2/sqliteman/importtablelogdialog.h0000644000175000001440000000133511407213302021466 0ustar subzerousers/* For general Sqliteman copyright and licensing information please refer to the COPYING file provided with the program. Following this notice may exist a copyright and/or license notice that predates the release of Sqliteman for which a new license (GPL+exception) is in place. */ #ifndef IMPORTTABLELOGDIALOG_H #define IMPORTTABLELOGDIALOG_H #include "ui_importtablelogdialog.h" #include /*! \brief Simple import log viewer. Used from ImportTableDialog as a result viewer when an import error occurs. \author Petr Vanek */ class ImportTableLogDialog : public QDialog, public Ui::ImportTableLogDialog { Q_OBJECT public: ImportTableLogDialog(QStringList log, QWidget * parent = 0); }; #endif sqliteman-1.2.2/sqliteman/qscintilla2/0000755000175000001440000000000011407213302017334 5ustar subzerouserssqliteman-1.2.2/sqliteman/qscintilla2/Qt4/0000755000175000001440000000000011407213302020004 5ustar subzerouserssqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerlua.cpp0000644000175000001440000001755011407213302023221 0ustar subzerousers// This module implements the QsciLexerLua class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerlua.h" #include #include #include // The ctor. QsciLexerLua::QsciLexerLua(QObject *parent) : QsciLexer(parent), fold_compact(true) { } // The dtor. QsciLexerLua::~QsciLexerLua() { } // Returns the language name. const char *QsciLexerLua::language() const { return "Lua"; } // Returns the lexer name. const char *QsciLexerLua::lexer() const { return "lua"; } // Return the list of characters that can start a block. const char *QsciLexerLua::blockStart(int *style) const { if (style) *style = Operator; return ""; } // Return the style used for braces. int QsciLexerLua::braceStyle() const { return Operator; } // Returns the foreground colour of the text for a style. QColor QsciLexerLua::defaultColor(int style) const { switch (style) { case Default: return QColor(0x00,0x00,0x00); case Comment: case LineComment: return QColor(0x00,0x7f,0x00); case Number: return QColor(0x00,0x7f,0x7f); case Keyword: case BasicFunctions: case StringTableMathsFunctions: case CoroutinesIOSystemFacilities: return QColor(0x00,0x00,0x7f); case String: case Character: case LiteralString: return QColor(0x7f,0x00,0x7f); case Preprocessor: return QColor(0x7f,0x7f,0x00); case Operator: case Identifier: break; } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerLua::defaultEolFill(int style) const { if (style == Comment || style == UnclosedString) return true; return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerLua::defaultFont(int style) const { QFont f; switch (style) { case Comment: case LineComment: case LiteralString: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerLua::keywords(int set) const { if (set == 1) // Keywords. return "and break do else elseif end false for function if " "in local nil not or repeat return then true until " "while"; if (set == 2) // Basic functions. return "_ALERT _ERRORMESSAGE _INPUT _PROMPT _OUTPUT _STDERR " "_STDIN _STDOUT call dostring foreach foreachi getn " "globals newtype rawget rawset require sort tinsert " "tremove " "G getfenv getmetatable ipairs loadlib next pairs " "pcall rawegal rawget rawset require setfenv " "setmetatable xpcall string table math coroutine io " "os debug"; if (set == 3) // String, table and maths functions. return "abs acos asin atan atan2 ceil cos deg exp floor " "format frexp gsub ldexp log log10 max min mod rad " "random randomseed sin sqrt strbyte strchar strfind " "strlen strlower strrep strsub strupper tan " "string.byte string.char string.dump string.find " "string.len string.lower string.rep string.sub " "string.upper string.format string.gfind string.gsub " "table.concat table.foreach table.foreachi table.getn " "table.sort table.insert table.remove table.setn " "math.abs math.acos math.asin math.atan math.atan2 " "math.ceil math.cos math.deg math.exp math.floor " "math.frexp math.ldexp math.log math.log10 math.max " "math.min math.mod math.pi math.rad math.random " "math.randomseed math.sin math.sqrt math.tan"; if (set == 4) // Coroutine, I/O and system facilities. return "openfile closefile readfrom writeto appendto remove " "rename flush seek tmpfile tmpname read write clock " "date difftime execute exit getenv setlocale time " "coroutine.create coroutine.resume coroutine.status " "coroutine.wrap coroutine.yield io.close io.flush " "io.input io.lines io.open io.output io.read " "io.tmpfile io.type io.write io.stdin io.stdout " "io.stderr os.clock os.date os.difftime os.execute " "os.exit os.getenv os.remove os.rename os.setlocale " "os.time os.tmpname"; return 0; } // Returns the user name of a style. QString QsciLexerLua::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case LineComment: return tr("Line comment"); case Number: return tr("Number"); case Keyword: return tr("Keyword"); case String: return tr("String"); case Character: return tr("Character"); case LiteralString: return tr("Literal string"); case Preprocessor: return tr("Preprocessor"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case UnclosedString: return tr("Unclosed string"); case BasicFunctions: return tr("Basic functions"); case StringTableMathsFunctions: return tr("String, table and maths functions"); case CoroutinesIOSystemFacilities: return tr("Coroutines, i/o and system facilities"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerLua::defaultPaper(int style) const { switch (style) { case Comment: return QColor(0xd0,0xf0,0xf0); case LiteralString: return QColor(0xe0,0xff,0xff); case UnclosedString: return QColor(0xe0,0xc0,0xe0); case BasicFunctions: return QColor(0xd0,0xff,0xd0); case StringTableMathsFunctions: return QColor(0xd0,0xd0,0xff); case CoroutinesIOSystemFacilities: return QColor(0xff,0xd0,0xd0); } return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerLua::refreshProperties() { setCompactProp(); } // Read properties from the settings. bool QsciLexerLua::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_compact = qs.value(prefix + "foldcompact", true).toBool(); return rc; } // Write properties to the settings. bool QsciLexerLua::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldcompact", fold_compact); return rc; } // Return true if folds are compact. bool QsciLexerLua::foldCompact() const { return fold_compact; } // Set if folds are compact. void QsciLexerLua::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerLua::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexertex.cpp0000644000175000001440000001664011407213302023237 0ustar subzerousers// This module implements the QsciLexerTeX class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexertex.h" #include #include // The ctor. QsciLexerTeX::QsciLexerTeX(QObject *parent) : QsciLexer(parent) { } // The dtor. QsciLexerTeX::~QsciLexerTeX() { } // Returns the language name. const char *QsciLexerTeX::language() const { return "TeX"; } // Returns the lexer name. const char *QsciLexerTeX::lexer() const { return "tex"; } // Return the string of characters that comprise a word. const char *QsciLexerTeX::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\\@"; } // Returns the foreground colour of the text for a style. QColor QsciLexerTeX::defaultColor(int style) const { switch (style) { case Default: return QColor(0x3f,0x3f,0x3f); case Special: return QColor(0x00,0x7f,0x7f); case Group: return QColor(0x7f,0x00,0x00); case Symbol: return QColor(0x7f,0x7f,0x00); case Command: return QColor(0x00,0x7f,0x00); } return QsciLexer::defaultColor(style); } // Returns the set of keywords. const char *QsciLexerTeX::keywords(int set) const { if (set == 1) return "above abovedisplayshortskip abovedisplayskip " "abovewithdelims accent adjdemerits advance " "afterassignment aftergroup atop atopwithdelims " "badness baselineskip batchmode begingroup " "belowdisplayshortskip belowdisplayskip binoppenalty " "botmark box boxmaxdepth brokenpenalty catcode char " "chardef cleaders closein closeout clubpenalty copy " "count countdef cr crcr csname day deadcycles def " "defaulthyphenchar defaultskewchar delcode delimiter " "delimiterfactor delimeters delimitershortfall " "delimeters dimen dimendef discretionary " "displayindent displaylimits displaystyle " "displaywidowpenalty displaywidth divide " "doublehyphendemerits dp dump edef else " "emergencystretch end endcsname endgroup endinput " "endlinechar eqno errhelp errmessage " "errorcontextlines errorstopmode escapechar everycr " "everydisplay everyhbox everyjob everymath everypar " "everyvbox exhyphenpenalty expandafter fam fi " "finalhyphendemerits firstmark floatingpenalty font " "fontdimen fontname futurelet gdef global group " "globaldefs halign hangafter hangindent hbadness " "hbox hfil horizontal hfill horizontal hfilneg hfuzz " "hoffset holdinginserts hrule hsize hskip hss " "horizontal ht hyphenation hyphenchar hyphenpenalty " "hyphen if ifcase ifcat ifdim ifeof iffalse ifhbox " "ifhmode ifinner ifmmode ifnum ifodd iftrue ifvbox " "ifvmode ifvoid ifx ignorespaces immediate indent " "input inputlineno input insert insertpenalties " "interlinepenalty jobname kern language lastbox " "lastkern lastpenalty lastskip lccode leaders left " "lefthyphenmin leftskip leqno let limits linepenalty " "line lineskip lineskiplimit long looseness lower " "lowercase mag mark mathaccent mathbin mathchar " "mathchardef mathchoice mathclose mathcode mathinner " "mathop mathopen mathord mathpunct mathrel " "mathsurround maxdeadcycles maxdepth meaning " "medmuskip message mkern month moveleft moveright " "mskip multiply muskip muskipdef newlinechar noalign " "noboundary noexpand noindent nolimits nonscript " "scriptscript nonstopmode nulldelimiterspace " "nullfont number omit openin openout or outer output " "outputpenalty over overfullrule overline " "overwithdelims pagedepth pagefilllstretch " "pagefillstretch pagefilstretch pagegoal pageshrink " "pagestretch pagetotal par parfillskip parindent " "parshape parskip patterns pausing penalty " "postdisplaypenalty predisplaypenalty predisplaysize " "pretolerance prevdepth prevgraf radical raise read " "relax relpenalty right righthyphenmin rightskip " "romannumeral scriptfont scriptscriptfont " "scriptscriptstyle scriptspace scriptstyle " "scrollmode setbox setlanguage sfcode shipout show " "showbox showboxbreadth showboxdepth showlists " "showthe skewchar skip skipdef spacefactor spaceskip " "span special splitbotmark splitfirstmark " "splitmaxdepth splittopskip string tabskip textfont " "textstyle the thickmuskip thinmuskip time toks " "toksdef tolerance topmark topskip tracingcommands " "tracinglostchars tracingmacros tracingonline " "tracingoutput tracingpages tracingparagraphs " "tracingrestores tracingstats uccode uchyph " "underline unhbox unhcopy unkern unpenalty unskip " "unvbox unvcopy uppercase vadjust valign vbadness " "vbox vcenter vfil vfill vfilneg vfuzz voffset vrule " "vsize vskip vsplit vss vtop wd widowpenalty write " "xdef xleaders xspaceskip year " "TeX bgroup egroup endgraf space empty null newcount " "newdimen newskip newmuskip newbox newtoks newhelp " "newread newwrite newfam newlanguage newinsert newif " "maxdimen magstephalf magstep frenchspacing " "nonfrenchspacing normalbaselines obeylines " "obeyspaces raggedr ight ttraggedright thinspace " "negthinspace enspace enskip quad qquad smallskip " "medskip bigskip removelastskip topglue vglue hglue " "break nobreak allowbreak filbreak goodbreak " "smallbreak medbreak bigbreak line leftline " "rightline centerline rlap llap underbar strutbox " "strut cases matrix pmatrix bordermatrix eqalign " "displaylines eqalignno leqalignno pageno folio " "tracingall showhyphens fmtname fmtversion hphantom " "vphantom phantom smash"; return 0; } // Returns the user name of a style. QString QsciLexerTeX::description(int style) const { switch (style) { case Default: return tr("Default"); case Special: return tr("Special"); case Group: return tr("Group"); case Symbol: return tr("Symbol"); case Command: return tr("Command"); case Text: return tr("Text"); } return QString(); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexercmake.cpp0000644000175000001440000001777011407213302023524 0ustar subzerousers// This module implements the QsciLexerCMake class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexercmake.h" #include #include #include // The ctor. QsciLexerCMake::QsciLexerCMake(QObject *parent) : QsciLexer(parent), fold_atelse(false) { } // The dtor. QsciLexerCMake::~QsciLexerCMake() { } // Returns the language name. const char *QsciLexerCMake::language() const { return "CMake"; } // Returns the lexer name. const char *QsciLexerCMake::lexer() const { return "cmake"; } // Returns the foreground colour of the text for a style. QColor QsciLexerCMake::defaultColor(int style) const { switch (style) { case Default: case KeywordSet3: return QColor(0x00,0x00,0x00); case Comment: return QColor(0x00,0x7f,0x00); case String: case StringLeftQuote: case StringRightQuote: return QColor(0x7f,0x00,0x7f); case Function: case BlockWhile: case BlockForeach: case BlockIf: case BlockMacro: return QColor(0x00,0x00,0x7f); case Variable: return QColor(0x80,0x00,0x00); case Label: case StringVariable: return QColor(0xcc,0x33,0x00); case Number: return QColor(0x00,0x7f,0x7f); } return QsciLexer::defaultColor(style); } // Returns the font of the text for a style. QFont QsciLexerCMake::defaultFont(int style) const { QFont f; switch (style) { case Comment: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case Function: case BlockWhile: case BlockForeach: case BlockIf: case BlockMacro: f = QsciLexer::defaultFont(style); f.setBold(true); break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerCMake::keywords(int set) const { if (set == 1) return "add_custom_command add_custom_target add_definitions " "add_dependencies add_executable add_library add_subdirectory " "add_test aux_source_directory build_command build_name " "cmake_minimum_required configure_file create_test_sourcelist " "else elseif enable_language enable_testing endforeach endif " "endmacro endwhile exec_program execute_process " "export_library_dependencies file find_file find_library " "find_package find_path find_program fltk_wrap_ui foreach " "get_cmake_property get_directory_property get_filename_component " "get_source_file_property get_target_property get_test_property " "if include include_directories include_external_msproject " "include_regular_expression install install_files " "install_programs install_targets link_directories link_libraries " "list load_cache load_command macro make_directory " "mark_as_advanced math message option output_required_files " "project qt_wrap_cpp qt_wrap_ui remove remove_definitions " "separate_arguments set set_directory_properties " "set_source_files_properties set_target_properties " "set_tests_properties site_name source_group string " "subdir_depends subdirs target_link_libraries try_compile try_run " "use_mangled_mesa utility_source variable_requires " "vtk_make_instantiator vtk_wrap_java vtk_wrap_python vtk_wrap_tcl " "while write_file"; if (set == 2) return "ABSOLUTE ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ALL AND APPEND " "ARGS ASCII BEFORE CACHE CACHE_VARIABLES CLEAR COMMAND COMMANDS " "COMMAND_NAME COMMENT COMPARE COMPILE_FLAGS COPYONLY DEFINED " "DEFINE_SYMBOL DEPENDS DOC EQUAL ESCAPE_QUOTES EXCLUDE " "EXCLUDE_FROM_ALL EXISTS EXPORT_MACRO EXT EXTRA_INCLUDE " "FATAL_ERROR FILE FILES FORCE FUNCTION GENERATED GLOB " "GLOB_RECURSE GREATER GROUP_SIZE HEADER_FILE_ONLY HEADER_LOCATION " "IMMEDIATE INCLUDES INCLUDE_DIRECTORIES INCLUDE_INTERNALS " "INCLUDE_REGULAR_EXPRESSION LESS LINK_DIRECTORIES LINK_FLAGS " "LOCATION MACOSX_BUNDLE MACROS MAIN_DEPENDENCY MAKE_DIRECTORY " "MATCH MATCHALL MATCHES MODULE NAME NAME_WE NOT NOTEQUAL " "NO_SYSTEM_PATH OBJECT_DEPENDS OPTIONAL OR OUTPUT OUTPUT_VARIABLE " "PATH PATHS POST_BUILD POST_INSTALL_SCRIPT PREFIX PREORDER " "PRE_BUILD PRE_INSTALL_SCRIPT PRE_LINK PROGRAM PROGRAM_ARGS " "PROPERTIES QUIET RANGE READ REGEX REGULAR_EXPRESSION REPLACE " "REQUIRED RETURN_VALUE RUNTIME_DIRECTORY SEND_ERROR SHARED " "SOURCES STATIC STATUS STREQUAL STRGREATER STRLESS SUFFIX TARGET " "TOLOWER TOUPPER VAR VARIABLES VERSION WIN32 WRAP_EXCLUDE WRITE " "APPLE MINGW MSYS CYGWIN BORLAND WATCOM MSVC MSVC_IDE MSVC60 " "MSVC70 MSVC71 MSVC80 CMAKE_COMPILER_2005 OFF ON"; return 0; } // Returns the user name of a style. QString QsciLexerCMake::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case String: return tr("String"); case StringLeftQuote: return tr("Left quoted string"); case StringRightQuote: return tr("Right quoted string"); case Function: return tr("Function"); case Variable: return tr("Variable"); case Label: return tr("Label"); case KeywordSet3: return tr("User defined"); case BlockWhile: return tr("WHILE block"); case BlockForeach: return tr("FOREACH block"); case BlockIf: return tr("IF block"); case BlockMacro: return tr("MACRO block"); case StringVariable: return tr("Variable within a string"); case Number: return tr("Number"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerCMake::defaultPaper(int style) const { switch (style) { case String: case StringLeftQuote: case StringRightQuote: case StringVariable: return QColor(0xee,0xee,0xee); } return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerCMake::refreshProperties() { setAtElseProp(); } // Read properties from the settings. bool QsciLexerCMake::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_atelse = qs.value(prefix + "foldatelse", false).toBool(); return rc; } // Write properties to the settings. bool QsciLexerCMake::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldatelse", fold_atelse); return rc; } // Return true if ELSE blocks can be folded. bool QsciLexerCMake::foldAtElse() const { return fold_atelse; } // Set if ELSE blocks can be folded. void QsciLexerCMake::setFoldAtElse(bool fold) { fold_atelse = fold; setAtElseProp(); } // Set the "fold.at.else" property. void QsciLexerCMake::setAtElseProp() { emit propertyChanged("fold.at.else",(fold_atelse ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexercsharp.cpp0000644000175000001440000000614311407213302023714 0ustar subzerousers// This module implements the QsciLexerCSharp class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexercsharp.h" #include #include // The ctor. QsciLexerCSharp::QsciLexerCSharp(QObject *parent) : QsciLexerCPP(parent) { } // The dtor. QsciLexerCSharp::~QsciLexerCSharp() { } // Returns the language name. const char *QsciLexerCSharp::language() const { return "C#"; } // Returns the foreground colour of the text for a style. QColor QsciLexerCSharp::defaultColor(int style) const { if (style == VerbatimString) return QColor(0x00,0x7f,0x00); return QsciLexerCPP::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerCSharp::defaultEolFill(int style) const { if (style == VerbatimString) return true; return QsciLexerCPP::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerCSharp::defaultFont(int style) const { if (style == VerbatimString) #if defined(Q_OS_WIN) return QFont("Courier New",10); #else return QFont("Bitstream Vera Sans Mono",9); #endif return QsciLexerCPP::defaultFont(style); } // Returns the set of keywords. const char *QsciLexerCSharp::keywords(int set) const { if (set != 1) return 0; return "abstract as base bool break byte case catch char checked " "class const continue decimal default delegate do double else " "enum event explicit extern false finally fixed float for " "foreach goto if implicit in int interface internal is lock " "long namespace new null object operator out override params " "private protected public readonly ref return sbyte sealed " "short sizeof stackalloc static string struct switch this " "throw true try typeof uint ulong unchecked unsafe ushort " "using virtual void while"; } // Returns the user name of a style. QString QsciLexerCSharp::description(int style) const { if (style == VerbatimString) return tr("Verbatim string"); return QsciLexerCPP::description(style); } // Returns the background colour of the text for a style. QColor QsciLexerCSharp::defaultPaper(int style) const { if (style == VerbatimString) return QColor(0xe0,0xff,0xe0); return QsciLexer::defaultPaper(style); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qsciscintilla.cpp0000644000175000001440000023233311407213302023360 0ustar subzerousers// This module implements the "official" high-level API of the Qt port of // Scintilla. It is modelled on QTextEdit - a method of the same name should // behave in the same way. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qsciscintilla.h" #include #include #include #include "Qsci/qsciapis.h" #include "Qsci/qscicommandset.h" #include "Qsci/qscilexer.h" #include "ListBoxQt.h" // Make sure these match the values in Scintilla.h. We don't #include that // file because it just causes more clashes. #define KEYWORDSET_MAX 8 #define MARKER_MAX 31 // The default fold margin width. static const int defaultFoldMarginWidth = 14; // The default set of characters that make up a word. static const char *defaultWordChars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; // The ctor. QsciScintilla::QsciScintilla(QWidget *parent) : QsciScintillaBase(parent), allocatedMarkers(0), oldPos(-1), selText(false), fold(NoFoldStyle), autoInd(false), braceMode(NoBraceMatch), acSource(AcsNone), acThresh(-1), wchars(defaultWordChars), call_tips_style(CallTipsNoContext), maxCallTips(-1), showSingle(false), modified(false), explicit_fillups(""), fillups_enabled(false) { connect(this,SIGNAL(SCN_MODIFYATTEMPTRO()), SIGNAL(modificationAttempted())); connect(this,SIGNAL(SCN_MODIFIED(int,int,const char *,int,int,int,int,int)), SLOT(handleModified(int,int,const char *,int,int,int,int,int))); connect(this,SIGNAL(SCN_CALLTIPCLICK(int)), SLOT(handleCallTipClick(int))); connect(this,SIGNAL(SCN_CHARADDED(int)), SLOT(handleCharAdded(int))); connect(this,SIGNAL(SCN_MARGINCLICK(int,int,int)), SLOT(handleMarginClick(int,int,int))); connect(this,SIGNAL(SCN_SAVEPOINTREACHED()), SLOT(handleSavePointReached())); connect(this,SIGNAL(SCN_SAVEPOINTLEFT()), SLOT(handleSavePointLeft())); connect(this,SIGNAL(SCN_UPDATEUI()), SLOT(handleUpdateUI())); connect(this,SIGNAL(QSCN_SELCHANGED(bool)), SLOT(handleSelectionChanged(bool))); connect(this,SIGNAL(SCN_AUTOCSELECTION(const char *,int)), SLOT(handleAutoCompletionSelection())); connect(this,SIGNAL(SCN_USERLISTSELECTION(const char *,int)), SLOT(handleUserListSelection(const char *,int))); // Set the default font. setFont(QApplication::font()); // Set the default fore and background colours. QPalette pal = QApplication::palette(); setColor(pal.text().color()); setPaper(pal.base().color()); #if defined(Q_OS_WIN) setEolMode(EolWindows); #elif defined(Q_OS_MAC) setEolMode(EolMac); #else setEolMode(EolUnix); #endif // Capturing the mouse seems to cause problems on multi-head systems. Qt // should do the right thing anyway. SendScintilla(SCI_SETMOUSEDOWNCAPTURES, 0UL); SendScintilla(SCI_SETPROPERTY, "fold", "1"); setMatchedBraceForegroundColor(Qt::blue); setUnmatchedBraceForegroundColor(Qt::red); setLexer(); // Set the visible policy. These are the same as SciTE's defaults // which, presumably, are sensible. SendScintilla(SCI_SETVISIBLEPOLICY, VISIBLE_STRICT | VISIBLE_SLOP, 4); // Create the standard command set. stdCmds = new QsciCommandSet(this); doc.display(this,0); } // The dtor. QsciScintilla::~QsciScintilla() { doc.undisplay(this); delete stdCmds; } // Return the current text colour. QColor QsciScintilla::color() const { return nl_text_colour; } // Set the text colour. void QsciScintilla::setColor(const QColor &c) { if (lex.isNull()) { // Assume style 0 applies to everything so that we don't need to use // SCI_STYLECLEARALL which clears everything. SendScintilla(SCI_STYLESETFORE, 0, c); nl_text_colour = c; } } // Return the current paper colour. QColor QsciScintilla::paper() const { return nl_paper_colour; } // Set the paper colour. void QsciScintilla::setPaper(const QColor &c) { if (lex.isNull()) { // Assume style 0 applies to everything so that we don't need to use // SCI_STYLECLEARALL which clears everything. We still have to set the // default style as well for the background without any text. SendScintilla(SCI_STYLESETBACK, 0, c); SendScintilla(SCI_STYLESETBACK, STYLE_DEFAULT, c); nl_paper_colour = c; } } // Set the default font. void QsciScintilla::setFont(const QFont &f) { if (lex.isNull()) { // Assume style 0 applies to everything so that we don't need to use // SCI_STYLECLEARALL which clears everything. setStylesFont(f, 0); QWidget::setFont(f); } } // Enable/disable auto-indent. void QsciScintilla::setAutoIndent(bool autoindent) { autoInd = autoindent; } // Set the brace matching mode. void QsciScintilla::setBraceMatching(BraceMatch bm) { braceMode = bm; } // Handle the addition of a character. void QsciScintilla::handleCharAdded(int ch) { // Ignore if there is a selection. long pos = SendScintilla(SCI_GETSELECTIONSTART); if (pos != SendScintilla(SCI_GETSELECTIONEND) || pos == 0) return; // If auto-completion is already active then see if this character is a // start character. If it is then create a new list which will be a subset // of the current one. The case where it isn't a start character seems to // be handled correctly elsewhere. if (isListActive()) { if (isStartChar(ch)) { cancelList(); startAutoCompletion(acSource, false, false); } return; } // Handle call tips. if (call_tips_style != CallTipsNone && !lex.isNull() && strchr("(),", ch) != NULL) callTip(); // Handle auto-indentation. if (autoInd) if (lex.isNull() || (lex->autoIndentStyle() & AiMaintain)) maintainIndentation(ch, pos); else autoIndentation(ch, pos); // See if we might want to start auto-completion. if (!isCallTipActive() && acSource != AcsNone) if (isStartChar(ch)) startAutoCompletion(acSource, false, false); else if (acThresh >= 1 && isWordCharacter(ch)) startAutoCompletion(acSource, true, false); } // See if a call tip is active. bool QsciScintilla::isCallTipActive() const { return SendScintilla(SCI_CALLTIPACTIVE); } // Handle a possible change to any current call tip. void QsciScintilla::callTip() { QsciAPIs *apis = lex->apis(); if (!apis) return; int pos, commas = 0; bool found = false; char ch; pos = SendScintilla(SCI_GETCURRENTPOS); // Move backwards through the line looking for the start of the current // call tip and working out which argument it is. while ((ch = getCharacter(pos)) != '\0') { if (ch == ',') ++commas; else if (ch == ')') { int depth = 1; // Ignore everything back to the start of the corresponding // parenthesis. while ((ch = getCharacter(pos)) != '\0') { if (ch == ')') ++depth; else if (ch == '(' && --depth == 0) break; } } else if (ch == '(') { found = true; break; } } // Cancel any existing call tip. SendScintilla(SCI_CALLTIPCANCEL); // Done if there is no new call tip to set. if (!found) return; QStringList context = contextWords(pos, &ctPos); if (context.isEmpty()) return; // The last word is complete, not partial. context << QString(); int ctshift; QString ct = apis->callTips(context, call_tips_style, maxCallTips, commas, ctshift); if (ct.isEmpty()) return; QByteArray ct_ba = ct.toLatin1(); const char *cts = ct_ba.data(); SendScintilla(SCI_CALLTIPSHOW, adjustedCallTipPosition(ctshift), cts); // Done if there is more than one line in the call tip or there isn't a // down arrow at the start. if (cts[0] == '\002' || strchr(cts, '\n')) return; // Highlight the current argument. const char *astart; if (commas == 0) astart = strchr(cts, '('); else for (astart = strchr(cts, ','); astart && --commas > 0; astart = strchr(astart + 1, ',')) ; if (!astart || !*++astart) return; // The end is at the next comma or unmatched closing parenthesis. const char *aend; int depth = 0; for (aend = astart; *aend; ++aend) { char ch = *aend; if (ch == ',' && depth == 0) break; else if (ch == '(') ++depth; else if (ch == ')') { if (depth == 0) break; --depth; } } if (astart != aend) SendScintilla(SCI_CALLTIPSETHLT, astart - cts, aend - cts); } // Handle a call tip click. void QsciScintilla::handleCallTipClick(int dir) { int ctshift; QString ct = lex->apis()->callTipsNextPrev(dir, ctshift); if (ct.isNull()) return; SendScintilla(SCI_CALLTIPSHOW, adjustedCallTipPosition(ctshift), ct.toLatin1().data()); } // Shift the position of the call tip (to take any context into account) but // don't go before the start of the line. int QsciScintilla::adjustedCallTipPosition(int ctshift) const { int ct = ctPos; if (ctshift) { int ctmin = SendScintilla(SCI_POSITIONFROMLINE, SendScintilla(SCI_LINEFROMPOSITION, ct)); if (ct - ctshift < ctmin) ct = ctmin; } return ct; } // Return the list of words that make up the context preceding the given // position. The list will only have more than one element if there is a lexer // set and it defines start strings. If so, then the last element might be // empty if a start string has just been typed. On return pos is at the start // of the context. QStringList QsciScintilla::contextWords(int &pos, int *last_word) { enum { Either, Separator, Word }; QStringList words; int good_pos = pos, expecting = Either; while (pos > 0) { if (getSeparator(pos)) { if (expecting == Either) words.prepend(QString()); else if (expecting == Word) break; good_pos = pos; expecting = Word; } else { QString word = getWord(pos); if (word.isEmpty() || expecting == Separator) break; words.prepend(word); good_pos = pos; expecting = Separator; // Return the position of the start of the last word if required. if (last_word) { *last_word = pos; last_word = 0; } } // Strip any preceding spaces (mainly around operators). char ch; while ((ch = getCharacter(pos)) != '\0') { // This is the same definition of space that Scintilla uses. if (ch != ' ' && (ch < 0x09 || ch > 0x0d)) { ++pos; break; } } } // A valid sequence always starts with a word and so should be expecting a // separator. if (expecting != Separator) words.clear(); pos = good_pos; return words; } // Try and get a lexer's word separator from the text before the current // position. Return true if one was found and adjust the position accordingly. bool QsciScintilla::getSeparator(int &pos) const { int opos = pos; // Go through each separator. for (int i = 0; i < wseps.count(); ++i) { const QString &ws = wseps[i]; // Work backwards. uint l; for (l = ws.length(); l; --l) { char ch = getCharacter(pos); if (ch == '\0' || ws.at(l - 1) != ch) break; } if (!l) return true; // Reset for the next separator. pos = opos; } return false; } // Try and get a word from the text before the current position. Return the // word if one was found and adjust the position accordingly. QString QsciScintilla::getWord(int &pos) const { QString word; bool numeric = true; char ch; while ((ch = getCharacter(pos)) != '\0') { if (!isWordCharacter(ch)) { ++pos; break; } if (ch < '0' || ch > '9') numeric = false; word.prepend(ch); } // We don't auto-complete numbers. if (numeric) word.truncate(0); return word; } // Get the "next" character (ie. the one before the current position) in the // current line. The character will be '\0' if there are no more. char QsciScintilla::getCharacter(int &pos) const { if (pos <= 0) return '\0'; char ch = SendScintilla(SCI_GETCHARAT, --pos); // Don't go past the end of the previous line. if (ch == '\n' || ch == '\r') { ++pos; return '\0'; } return ch; } // See if a character is an auto-completion start character, ie. the last // character of a word separator. bool QsciScintilla::isStartChar(char ch) const { QString s = QChar(ch); for (int i = 0; i < wseps.count(); ++i) if (wseps[i].endsWith(s)) return true; return false; } // Possibly start auto-completion. void QsciScintilla::startAutoCompletion(AutoCompletionSource acs, bool checkThresh, bool single) { int start = SendScintilla(SCI_GETCURRENTPOS); QStringList context = contextWords(start); if (context.isEmpty()) return; // Get the last word's raw data and length. const QString &last = context.last(); const char *last_data; int last_len; QByteArray s; if (isUtf8()) { s = last.toUtf8(); last_data = s.data(); last_len = s.length(); } else { s = last.toLatin1(); last_data = s.data(); last_len = s.length(); } if (checkThresh && last_len < acThresh) return; // Generate the string representing the valid words to select from. QStringList wlist; if ((acs == AcsAll || acs == AcsAPIs) && !lex.isNull()) { QsciAPIs *apis = lex->apis(); if (apis) apis->autoCompletionList(context, wlist); } if (acs == AcsAll || acs == AcsDocument) { int sflags = SCFIND_WORDSTART; if (!SendScintilla(SCI_AUTOCGETIGNORECASE)) sflags |= SCFIND_MATCHCASE; SendScintilla(SCI_SETSEARCHFLAGS, sflags); int pos = 0; int dlen = SendScintilla(SCI_GETLENGTH); int caret = SendScintilla(SCI_GETCURRENTPOS); int clen = caret - start; char *orig_context = new char[clen + 1]; SendScintilla(SCI_GETTEXTRANGE, start, caret, orig_context); for (;;) { int fstart; SendScintilla(SCI_SETTARGETSTART, pos); SendScintilla(SCI_SETTARGETEND, dlen); if ((fstart = SendScintilla(SCI_SEARCHINTARGET, clen, orig_context)) < 0) break; // Move past the root part. pos = fstart + clen; // Skip if this is the context we are auto-completing. if (pos == caret) continue; // Get the rest of this word. QString w = last_data; while (pos < dlen) { char ch = SendScintilla(SCI_GETCHARAT, pos); if (!isWordCharacter(ch)) break; w += ch; ++pos; } // Add the word if it isn't already there. if (!w.isEmpty() && !wlist.contains(w)) wlist.append(w); } delete []orig_context; } if (wlist.isEmpty()) return; wlist.sort(); const char sep = '\x03'; SendScintilla(SCI_AUTOCSETCHOOSESINGLE, single); SendScintilla(SCI_AUTOCSETSEPARATOR, sep); QByteArray chlist = wlist.join(QChar(sep)).toLatin1(); SendScintilla(SCI_AUTOCSHOW, last_len, chlist.constData()); } // Maintain the indentation of the previous line. void QsciScintilla::maintainIndentation(char ch, long pos) { if (ch != '\r' && ch != '\n') return; int curr_line = SendScintilla(SCI_LINEFROMPOSITION, pos); // Get the indentation of the preceding non-zero length line. int ind = 0; for (int line = curr_line - 1; line >= 0; --line) { if (SendScintilla(SCI_GETLINEENDPOSITION, line) > SendScintilla(SCI_POSITIONFROMLINE, line)) { ind = indentation(line); break; } } if (ind > 0) autoIndentLine(pos, curr_line, ind); } // Implement auto-indentation. void QsciScintilla::autoIndentation(char ch, long pos) { int curr_line = SendScintilla(SCI_LINEFROMPOSITION, pos); int ind_width = indentWidth(); long curr_line_start = SendScintilla(SCI_POSITIONFROMLINE, curr_line); const char *block_start = lex->blockStart(); bool start_single = (block_start && qstrlen(block_start) == 1); const char *block_end = lex->blockEnd(); bool end_single = (block_end && qstrlen(block_end) == 1); if (end_single && block_end[0] == ch) { if (!(lex->autoIndentStyle() & AiClosing) && rangeIsWhitespace(curr_line_start, pos - 1)) autoIndentLine(pos, curr_line, blockIndent(curr_line - 1) - ind_width); } else if (start_single && block_start[0] == ch) { // De-indent if we have already indented because the previous line was // a start of block keyword. if (!(lex->autoIndentStyle() & AiOpening) && curr_line > 0 && getIndentState(curr_line - 1) == isKeywordStart && rangeIsWhitespace(curr_line_start, pos - 1)) autoIndentLine(pos, curr_line, blockIndent(curr_line - 1) - ind_width); } else if (ch == '\r' || ch == '\n') autoIndentLine(pos, curr_line, blockIndent(curr_line - 1)); } // Set the indentation for a line. void QsciScintilla::autoIndentLine(long pos, int line, int indent) { if (indent < 0) return; long pos_before = SendScintilla(SCI_GETLINEINDENTPOSITION, line); SendScintilla(SCI_SETLINEINDENTATION, line, indent); long pos_after = SendScintilla(SCI_GETLINEINDENTPOSITION, line); long new_pos = -1; if (pos_after > pos_before) new_pos = pos + (pos_after - pos_before); else if (pos_after < pos_before && pos >= pos_after) if (pos >= pos_before) new_pos = pos + (pos_after - pos_before); else new_pos = pos_after; if (new_pos >= 0) SendScintilla(SCI_SETSEL, new_pos, new_pos); } // Return the indentation of the block defined by the given line (or something // significant before). int QsciScintilla::blockIndent(int line) { if (line < 0) return 0; // Handle the trvial case. if (!lex->blockStartKeyword() && !lex->blockStart() && !lex->blockEnd()) return indentation(line); int line_limit = line - lex->blockLookback(); if (line_limit < 0) line_limit = 0; for (int l = line; l >= line_limit; --l) { IndentState istate = getIndentState(l); if (istate != isNone) { int ind_width = indentWidth(); int ind = indentation(l); if (istate == isBlockStart) { if (!(lex -> autoIndentStyle() & AiOpening)) ind += ind_width; } else if (istate == isBlockEnd) { if (lex -> autoIndentStyle() & AiClosing) ind -= ind_width; if (ind < 0) ind = 0; } else if (line == l) ind += ind_width; return ind; } } return indentation(line); } // Return true if all characters starting at spos up to, but not including // epos, are spaces or tabs. bool QsciScintilla::rangeIsWhitespace(long spos, long epos) { while (spos < epos) { char ch = SendScintilla(SCI_GETCHARAT, spos); if (ch != ' ' && ch != '\t') return false; ++spos; } return true; } // Returns the indentation state of a line. QsciScintilla::IndentState QsciScintilla::getIndentState(int line) { IndentState istate; // Get the styled text. long spos = SendScintilla(SCI_POSITIONFROMLINE, line); long epos = SendScintilla(SCI_POSITIONFROMLINE, line + 1); char *text = new char[(epos - spos + 1) * 2]; SendScintilla(SCI_GETSTYLEDTEXT, spos, epos, text); int style, bstart_off, bend_off; // Block start/end takes precedence over keywords. const char *bstart_words = lex->blockStart(&style); bstart_off = findStyledWord(text, style, bstart_words); const char *bend_words = lex->blockEnd(&style); bend_off = findStyledWord(text, style, bend_words); // If there is a block start but no block end characters then ignore it // unless the block start is the last significant thing on the line, ie. // assume Python-like blocking. if (bstart_off >= 0 && !bend_words) for (int i = bstart_off * 2; text[i] != '\0'; i += 2) if (!QChar(text[i]).isSpace()) return isNone; if (bstart_off > bend_off) istate = isBlockStart; else if (bend_off > bstart_off) istate = isBlockEnd; else { const char *words = lex->blockStartKeyword(&style); istate = (findStyledWord(text,style,words) >= 0) ? isKeywordStart : isNone; } delete[] text; return istate; } // text is a pointer to some styled text (ie. a character byte followed by a // style byte). style is a style number. words is a space separated list of // words. Returns the position in the text immediately after the last one of // the words with the style. The reason we are after the last, and not the // first, occurance is that we are looking for words that start and end a block // where the latest one is the most significant. int QsciScintilla::findStyledWord(const char *text, int style, const char *words) { if (!words) return -1; // Find the range of text with the style we are looking for. const char *stext; for (stext = text; stext[1] != style; stext += 2) if (stext[0] == '\0') return -1; // Move to the last character. const char *etext = stext; while (etext[2] != '\0') etext += 2; // Backtrack until we find the style. There will be one. while (etext[1] != style) etext -= 2; // Look for each word in turn. while (words[0] != '\0') { // Find the end of the word. const char *eword = words; while (eword[1] != ' ' && eword[1] != '\0') ++eword; // Now search the text backwards. const char *wp = eword; for (const char *tp = etext; tp >= stext; tp -= 2) { if (tp[0] != wp[0] || tp[1] != style) { // Reset the search. wp = eword; continue; } // See if all the word has matched. if (wp-- == words) return ((tp - text) / 2) + (eword - words) + 1; } // Move to the start of the next word if there is one. words = eword + 1; if (words[0] == ' ') ++words; } return -1; } // Return true if the code page is UTF8. bool QsciScintilla::isUtf8() const { return (SendScintilla(SCI_GETCODEPAGE) == SC_CP_UTF8); } // Set the code page. void QsciScintilla::setUtf8(bool cp) { setAttribute(Qt::WA_InputMethodEnabled, cp); SendScintilla(SCI_SETCODEPAGE, (cp ? SC_CP_UTF8 : 0)); } // Return the end-of-line mode. QsciScintilla::EolMode QsciScintilla::eolMode() const { return (EolMode)SendScintilla(SCI_GETEOLMODE); } // Set the end-of-line mode. void QsciScintilla::setEolMode(EolMode mode) { SendScintilla(SCI_SETEOLMODE, mode); } // Convert the end-of-lines to a particular mode. void QsciScintilla::convertEols(EolMode mode) { SendScintilla(SCI_CONVERTEOLS, mode); } // Return the edge colour. QColor QsciScintilla::edgeColor() const { long res = SendScintilla(SCI_GETEDGECOLOUR); return QColor((int)res, ((int)(res >> 8)) & 0x00ff, ((int)(res >> 16)) & 0x00ff); } // Set the edge colour. void QsciScintilla::setEdgeColor(const QColor &col) { SendScintilla(SCI_SETEDGECOLOUR, col); } // Return the edge column. int QsciScintilla::edgeColumn() const { return SendScintilla(SCI_GETEDGECOLUMN); } // Set the edge column. void QsciScintilla::setEdgeColumn(int colnr) { SendScintilla(SCI_SETEDGECOLUMN, colnr); } // Return the edge mode. QsciScintilla::EdgeMode QsciScintilla::edgeMode() const { return (EdgeMode)SendScintilla(SCI_GETEDGEMODE); } // Set the edge mode. void QsciScintilla::setEdgeMode(EdgeMode mode) { SendScintilla(SCI_SETEDGEMODE, mode); } // Return the end-of-line visibility. bool QsciScintilla::eolVisibility() const { return SendScintilla(SCI_GETVIEWEOL); } // Set the end-of-line visibility. void QsciScintilla::setEolVisibility(bool visible) { SendScintilla(SCI_SETVIEWEOL, visible); } // Return the whitespace visibility. QsciScintilla::WhitespaceVisibility QsciScintilla::whitespaceVisibility() const { return (WhitespaceVisibility)SendScintilla(SCI_GETVIEWWS); } // Set the whitespace visibility. void QsciScintilla::setWhitespaceVisibility(WhitespaceVisibility mode) { SendScintilla(SCI_SETVIEWWS, mode); } // Return the line wrap mode. QsciScintilla::WrapMode QsciScintilla::wrapMode() const { return (WrapMode)SendScintilla(SCI_GETWRAPMODE); } // Set the line wrap mode. void QsciScintilla::setWrapMode(WrapMode mode) { SendScintilla(SCI_SETLAYOUTCACHE, (mode == WrapNone ? SC_CACHE_CARET : SC_CACHE_DOCUMENT)); SendScintilla(SCI_SETWRAPMODE, mode); } // Set the line wrap visual flags. void QsciScintilla::setWrapVisualFlags(WrapVisualFlag eflag, WrapVisualFlag sflag, int sindent) { int flags = SC_WRAPVISUALFLAG_NONE; int loc = SC_WRAPVISUALFLAGLOC_DEFAULT; if (eflag == WrapFlagByText) { flags |= SC_WRAPVISUALFLAG_END; loc |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT; } else if (eflag == WrapFlagByBorder) flags |= SC_WRAPVISUALFLAG_END; if (sflag == WrapFlagByText) { flags |= SC_WRAPVISUALFLAG_START; loc |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT; } else if (sflag == WrapFlagByBorder) flags |= SC_WRAPVISUALFLAG_START; SendScintilla(SCI_SETWRAPVISUALFLAGS, flags); SendScintilla(SCI_SETWRAPVISUALFLAGSLOCATION, loc); SendScintilla(SCI_SETWRAPSTARTINDENT, sindent); } // Set the folding style. void QsciScintilla::setFolding(FoldStyle folding) { fold = folding; if (folding == NoFoldStyle) { SendScintilla(SCI_SETMARGINWIDTHN, 2, 0L); return; } int mask = SendScintilla(SCI_GETMODEVENTMASK); SendScintilla(SCI_SETMODEVENTMASK, mask | SC_MOD_CHANGEFOLD); SendScintilla(SCI_SETFOLDFLAGS, SC_FOLDFLAG_LINEAFTER_CONTRACTED); SendScintilla(SCI_SETMARGINTYPEN, 2, (long)SC_MARGIN_SYMBOL); SendScintilla(SCI_SETMARGINMASKN, 2, SC_MASK_FOLDERS); SendScintilla(SCI_SETMARGINSENSITIVEN, 2, 1); // Set the marker symbols to use. switch (folding) { case PlainFoldStyle: setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS); setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS); setFoldMarker(SC_MARKNUM_FOLDERSUB); setFoldMarker(SC_MARKNUM_FOLDERTAIL); setFoldMarker(SC_MARKNUM_FOLDEREND); setFoldMarker(SC_MARKNUM_FOLDEROPENMID); setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL); break; case CircledFoldStyle: setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_CIRCLEMINUS); setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_CIRCLEPLUS); setFoldMarker(SC_MARKNUM_FOLDERSUB); setFoldMarker(SC_MARKNUM_FOLDERTAIL); setFoldMarker(SC_MARKNUM_FOLDEREND); setFoldMarker(SC_MARKNUM_FOLDEROPENMID); setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL); break; case BoxedFoldStyle: setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS); setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS); setFoldMarker(SC_MARKNUM_FOLDERSUB); setFoldMarker(SC_MARKNUM_FOLDERTAIL); setFoldMarker(SC_MARKNUM_FOLDEREND); setFoldMarker(SC_MARKNUM_FOLDEROPENMID); setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL); break; case CircledTreeFoldStyle: setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_CIRCLEMINUS); setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_CIRCLEPLUS); setFoldMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); setFoldMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNERCURVE); setFoldMarker(SC_MARKNUM_FOLDEREND, SC_MARK_CIRCLEPLUSCONNECTED); setFoldMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_CIRCLEMINUSCONNECTED); setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNERCURVE); break; case BoxedTreeFoldStyle: setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS); setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS); setFoldMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); setFoldMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER); setFoldMarker(SC_MARKNUM_FOLDEREND, SC_MARK_BOXPLUSCONNECTED); setFoldMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED); setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER); break; } SendScintilla(SCI_SETMARGINWIDTHN, 2, defaultFoldMarginWidth); } // Set up a folder marker. void QsciScintilla::setFoldMarker(int marknr, int mark) { SendScintilla(SCI_MARKERDEFINE, marknr, mark); if (mark != SC_MARK_EMPTY) { SendScintilla(SCI_MARKERSETFORE, marknr, QColor(Qt::white)); SendScintilla(SCI_MARKERSETBACK, marknr, QColor(Qt::black)); } } // Handle a click in the fold margin. This is mostly taken from SciTE. void QsciScintilla::foldClick(int lineClick, int bstate) { bool shift = bstate & Qt::ShiftModifier; bool ctrl = bstate & Qt::ControlModifier; if (shift && ctrl) { foldAll(); return; } int levelClick = SendScintilla(SCI_GETFOLDLEVEL, lineClick); if (levelClick & SC_FOLDLEVELHEADERFLAG) { if (shift) { // Ensure all children are visible. SendScintilla(SCI_SETFOLDEXPANDED, lineClick, 1); foldExpand(lineClick, true, true, 100, levelClick); } else if (ctrl) { if (SendScintilla(SCI_GETFOLDEXPANDED, lineClick)) { // Contract this line and all its children. SendScintilla(SCI_SETFOLDEXPANDED, lineClick, 0L); foldExpand(lineClick, false, true, 0, levelClick); } else { // Expand this line and all its children. SendScintilla(SCI_SETFOLDEXPANDED, lineClick, 1); foldExpand(lineClick, true, true, 100, levelClick); } } else { // Toggle this line. SendScintilla(SCI_TOGGLEFOLD, lineClick); } } } // Do the hard work of hiding and showing lines. This is mostly taken from // SciTE. void QsciScintilla::foldExpand(int &line, bool doExpand, bool force, int visLevels, int level) { int lineMaxSubord = SendScintilla(SCI_GETLASTCHILD, line, level & SC_FOLDLEVELNUMBERMASK); line++; while (line <= lineMaxSubord) { if (force) { if (visLevels > 0) SendScintilla(SCI_SHOWLINES, line, line); else SendScintilla(SCI_HIDELINES, line, line); } else if (doExpand) SendScintilla(SCI_SHOWLINES, line, line); int levelLine = level; if (levelLine == -1) levelLine = SendScintilla(SCI_GETFOLDLEVEL, line); if (levelLine & SC_FOLDLEVELHEADERFLAG) { if (force) { if (visLevels > 1) SendScintilla(SCI_SETFOLDEXPANDED, line, 1); else SendScintilla(SCI_SETFOLDEXPANDED, line, 0L); foldExpand(line, doExpand, force, visLevels - 1); } else if (doExpand) { if (!SendScintilla(SCI_GETFOLDEXPANDED, line)) SendScintilla(SCI_SETFOLDEXPANDED, line, 1); foldExpand(line, true, force, visLevels - 1); } else foldExpand(line, false, force, visLevels - 1); } else line++; } } // Fully expand (if there is any line currently folded) all text. Otherwise, // fold all text. This is mostly taken from SciTE. void QsciScintilla::foldAll(bool children) { recolor(); int maxLine = SendScintilla(SCI_GETLINECOUNT); bool expanding = true; for (int lineSeek = 0; lineSeek < maxLine; lineSeek++) { if (SendScintilla(SCI_GETFOLDLEVEL,lineSeek) & SC_FOLDLEVELHEADERFLAG) { expanding = !SendScintilla(SCI_GETFOLDEXPANDED, lineSeek); break; } } for (int line = 0; line < maxLine; line++) { int level = SendScintilla(SCI_GETFOLDLEVEL, line); if (!(level & SC_FOLDLEVELHEADERFLAG)) continue; if (children || (SC_FOLDLEVELBASE == (level & SC_FOLDLEVELNUMBERMASK))) { if (expanding) { SendScintilla(SCI_SETFOLDEXPANDED, line, 1); foldExpand(line, true, false, 0, level); line--; } else { int lineMaxSubord = SendScintilla(SCI_GETLASTCHILD, line, -1); SendScintilla(SCI_SETFOLDEXPANDED, line, 0L); if (lineMaxSubord > line) SendScintilla(SCI_HIDELINES, line + 1, lineMaxSubord); } } } } // Handle a fold change. This is mostly taken from SciTE. void QsciScintilla::foldChanged(int line,int levelNow,int levelPrev) { if (levelNow & SC_FOLDLEVELHEADERFLAG) { if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) SendScintilla(SCI_SETFOLDEXPANDED, line, 1); } else if (levelPrev & SC_FOLDLEVELHEADERFLAG) { if (!SendScintilla(SCI_GETFOLDEXPANDED, line)) { // Removing the fold from one that has been contracted so should // expand. Otherwise lines are left invisible with no way to make // them visible. foldExpand(line, true, false, 0, levelPrev); } } } // Toggle the fold for a line if it contains a fold marker. void QsciScintilla::foldLine(int line) { SendScintilla(SCI_TOGGLEFOLD, line); } // Handle the SCN_MODIFIED notification. void QsciScintilla::handleModified(int pos, int mtype, const char *text, int len, int added, int line, int foldNow, int foldPrev) { if (mtype & SC_MOD_CHANGEFOLD) { if (fold) foldChanged(line, foldNow, foldPrev); } if (mtype & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { emit textChanged(); if (added != 0) emit linesChanged(); } } // Zoom in a number of points. void QsciScintilla::zoomIn(int range) { zoomTo(SendScintilla(SCI_GETZOOM) + range); } // Zoom in a single point. void QsciScintilla::zoomIn() { SendScintilla(SCI_ZOOMIN); } // Zoom out a number of points. void QsciScintilla::zoomOut(int range) { zoomTo(SendScintilla(SCI_GETZOOM) - range); } // Zoom out a single point. void QsciScintilla::zoomOut() { SendScintilla(SCI_ZOOMOUT); } // Set the zoom to a number of points. void QsciScintilla::zoomTo(int size) { if (size < -10) size = -10; else if (size > 20) size = 20; SendScintilla(SCI_SETZOOM, size); } // Find the first occurrence of a string. bool QsciScintilla::findFirst(const QString &expr, bool re, bool cs, bool wo, bool wrap, bool forward, int line, int index, bool show) { findState.inProgress = false; if (expr.isEmpty()) return false; findState.expr = expr; findState.wrap = wrap; findState.forward = forward; findState.flags = (cs ? SCFIND_MATCHCASE : 0) | (wo ? SCFIND_WHOLEWORD : 0) | (re ? SCFIND_REGEXP : 0); if (line < 0 || index < 0) findState.startpos = SendScintilla(SCI_GETCURRENTPOS); else findState.startpos = posFromLineIndex(line, index); if (forward) findState.endpos = SendScintilla(SCI_GETLENGTH); else findState.endpos = 0; findState.show = show; return doFind(); } // Find the next occurrence of a string. bool QsciScintilla::findNext() { if (!findState.inProgress) return false; return doFind(); } // Do the hard work of findFirst() and findNext(). bool QsciScintilla::doFind() { SendScintilla(SCI_SETSEARCHFLAGS, findState.flags); int pos = simpleFind(); // See if it was found. If not and wraparound is wanted, try again. if (pos == -1 && findState.wrap) { if (findState.forward) { findState.startpos = 0; findState.endpos = SendScintilla(SCI_GETLENGTH); } else { findState.startpos = SendScintilla(SCI_GETLENGTH); findState.endpos = 0; } pos = simpleFind(); } if (pos == -1) { findState.inProgress = false; return false; } // It was found. long targstart = SendScintilla(SCI_GETTARGETSTART); long targend = SendScintilla(SCI_GETTARGETEND); // Ensure the text found is visible if required. if (findState.show) { int startLine = SendScintilla(SCI_LINEFROMPOSITION, targstart); int endLine = SendScintilla(SCI_LINEFROMPOSITION, targend); for (int i = startLine; i <= endLine; ++i) SendScintilla(SCI_ENSUREVISIBLEENFORCEPOLICY, i); } // Now set the selection. SendScintilla(SCI_SETSEL, targstart, targend); // Finally adjust the start position so that we don't find the same one // again. if (findState.forward) findState.startpos = targend; else if ((findState.startpos = targstart - 1) < 0) findState.startpos = 0; findState.inProgress = true; return true; } // Do a simple find between the start and end positions. int QsciScintilla::simpleFind() { if (findState.startpos == findState.endpos) return -1; SendScintilla(SCI_SETTARGETSTART, findState.startpos); SendScintilla(SCI_SETTARGETEND, findState.endpos); int pos; if (isUtf8()) { QByteArray s = findState.expr.toUtf8(); pos = SendScintilla(SCI_SEARCHINTARGET, s.length(), s.data()); } else { const char *s; int len; QByteArray ba = findState.expr.toLatin1(); s = ba; len = ba.length(); pos = SendScintilla(SCI_SEARCHINTARGET, len, s); } return pos; } // Replace the text found with the previous findFirst() or findNext(). void QsciScintilla::replace(const QString &replaceStr) { if (!findState.inProgress) return; long start = SendScintilla(SCI_GETSELECTIONSTART); SendScintilla(SCI_TARGETFROMSELECTION); long len; int cmd = (findState.flags & SCFIND_REGEXP) ? SCI_REPLACETARGETRE : SCI_REPLACETARGET; if (isUtf8()) { QByteArray s = replaceStr.toUtf8(); len = SendScintilla(cmd, -1, s.data()); } else { const char *s; QByteArray ba = replaceStr.toLatin1(); s = ba; len = SendScintilla(cmd, -1, s); } // Reset the selection. SendScintilla(SCI_SETSELECTIONSTART, start); SendScintilla(SCI_SETSELECTIONEND, start + len); if (findState.forward) findState.startpos = start + len; } // Query the modified state. bool QsciScintilla::isModified() const { // We don't use SCI_GETMODIFY as it seems to be buggy in Scintilla v1.61. return modified; } // Set the modified state. void QsciScintilla::setModified(bool m) { if (!m) SendScintilla(SCI_SETSAVEPOINT); } // Handle the SCN_MARGINCLICK notification. void QsciScintilla::handleMarginClick(int pos, int modifiers, int margin) { int state = 0; if (modifiers & SCMOD_SHIFT) state |= Qt::ShiftModifier; if (modifiers & SCMOD_CTRL) state |= Qt::ControlModifier; if (modifiers & SCMOD_ALT) state |= Qt::AltModifier; int line = SendScintilla(SCI_LINEFROMPOSITION, pos); if (fold && margin == 2) foldClick(line, state); else emit marginClicked(margin, line, Qt::KeyboardModifiers(state)); } // Handle the SCN_SAVEPOINTREACHED notification. void QsciScintilla::handleSavePointReached() { if (modified) { modified = false; emit modificationChanged(false); } } // Handle the SCN_SAVEPOINTLEFT notification. void QsciScintilla::handleSavePointLeft() { if (!modified) { modified = true; emit modificationChanged(true); } } // Handle the QSCN_SELCHANGED signal. void QsciScintilla::handleSelectionChanged(bool yes) { selText = yes; emit copyAvailable(yes); emit selectionChanged(); } // Get the current selection. void QsciScintilla::getSelection(int *lineFrom, int *indexFrom, int *lineTo, int *indexTo) const { if (selText) { lineIndexFromPos(SendScintilla(SCI_GETSELECTIONSTART), lineFrom, indexFrom); lineIndexFromPos(SendScintilla(SCI_GETSELECTIONEND), lineTo, indexTo); } else *lineFrom = *indexFrom = *lineTo = *indexTo = -1; } // Sets the current selection. void QsciScintilla::setSelection(int lineFrom, int indexFrom, int lineTo, int indexTo) { SendScintilla(SCI_SETSELECTIONSTART, posFromLineIndex(lineFrom, indexFrom)); SendScintilla(SCI_SETSELECTIONEND, posFromLineIndex(lineTo, indexTo)); } // Set the background colour of selected text. void QsciScintilla::setSelectionBackgroundColor(const QColor &col) { SendScintilla(SCI_SETSELBACK, 1, col); int alpha = qAlpha(col.rgb()); if (alpha < 255) SendScintilla(SCI_SETSELALPHA, alpha); } // Set the foreground colour of selected text. void QsciScintilla::setSelectionForegroundColor(const QColor &col) { SendScintilla(SCI_SETSELFORE, 1, col); } // Reset the background colour of selected text to the default. void QsciScintilla::resetSelectionBackgroundColor() { SendScintilla(SCI_SETSELALPHA, SC_ALPHA_NOALPHA); SendScintilla(SCI_SETSELBACK, 0UL); } // Reset the foreground colour of selected text to the default. void QsciScintilla::resetSelectionForegroundColor() { SendScintilla(SCI_SETSELFORE, 0UL); } // Set the fill to the end-of-line for the selection. void QsciScintilla::setSelectionToEol(bool filled) { SendScintilla(SCI_SETSELEOLFILLED, filled); } // Return the fill to the end-of-line for the selection. bool QsciScintilla::selectionToEol() const { return SendScintilla(SCI_GETSELEOLFILLED); } // Set the width of the caret. void QsciScintilla::setCaretWidth(int width) { SendScintilla(SCI_SETCARETWIDTH, width); } // Set the foreground colour of the caret. void QsciScintilla::setCaretForegroundColor(const QColor &col) { SendScintilla(SCI_SETCARETFORE, col); } // Set the background colour of the line containing the caret. void QsciScintilla::setCaretLineBackgroundColor(const QColor &col) { SendScintilla(SCI_SETCARETLINEBACK, col); int alpha = qAlpha(col.rgb()); if (alpha < 255) SendScintilla(SCI_SETCARETLINEBACKALPHA, alpha); } // Set the state of the background colour of the line containing the caret. void QsciScintilla::setCaretLineVisible(bool enable) { SendScintilla(SCI_SETCARETLINEVISIBLE, enable); } // Query the read-only state. bool QsciScintilla::isReadOnly() const { return SendScintilla(SCI_GETREADONLY); } // Set the read-only state. void QsciScintilla::setReadOnly(bool ro) { SendScintilla(SCI_SETREADONLY, ro); } // Append the given text. void QsciScintilla::append(const QString &text) { bool ro = ensureRW(); if (isUtf8()) { QByteArray s = text.toUtf8(); SendScintilla(SCI_APPENDTEXT, s.length(), s.data()); } else { const char *s; int len; QByteArray ba = text.toLatin1(); s = ba; len = ba.length(); SendScintilla(SCI_APPENDTEXT, len, s); } SendScintilla(SCI_EMPTYUNDOBUFFER); setReadOnly(ro); } // Insert the given text at the current position. void QsciScintilla::insert(const QString &text) { insertAtPos(text, -1); } // Insert the given text at the given line and offset. void QsciScintilla::insertAt(const QString &text, int line, int index) { insertAtPos(text, posFromLineIndex(line, index)); } // Insert the given text at the given position. void QsciScintilla::insertAtPos(const QString &text, long pos) { bool ro = ensureRW(); SendScintilla(SCI_BEGINUNDOACTION); if (isUtf8()) SendScintilla(SCI_INSERTTEXT, pos, text.toUtf8().data()); else SendScintilla(SCI_INSERTTEXT, pos, text.toLatin1().data()); SendScintilla(SCI_ENDUNDOACTION); setReadOnly(ro); } // Begin a sequence of undoable actions. void QsciScintilla::beginUndoAction() { SendScintilla(SCI_BEGINUNDOACTION); } // End a sequence of undoable actions. void QsciScintilla::endUndoAction() { SendScintilla(SCI_ENDUNDOACTION); } // Redo a sequence of actions. void QsciScintilla::redo() { SendScintilla(SCI_REDO); } // Undo a sequence of actions. void QsciScintilla::undo() { SendScintilla(SCI_UNDO); } // See if there is something to redo. bool QsciScintilla::isRedoAvailable() const { return SendScintilla(SCI_CANREDO); } // See if there is something to undo. bool QsciScintilla::isUndoAvailable() const { return SendScintilla(SCI_CANUNDO); } // Return the number of lines. int QsciScintilla::lines() const { return SendScintilla(SCI_GETLINECOUNT); } // Return the line at a position. int QsciScintilla::lineAt(const QPoint &pos) const { long chpos = SendScintilla(SCI_POSITIONFROMPOINTCLOSE, pos.x(), pos.y()); if (chpos < 0) return -1; return SendScintilla(SCI_LINEFROMPOSITION, chpos); } // Return the length of a line. int QsciScintilla::lineLength(int line) const { if (line < 0 || line >= SendScintilla(SCI_GETLINECOUNT)) return -1; return SendScintilla(SCI_LINELENGTH, line); } // Return the length of the current text. int QsciScintilla::length() const { return SendScintilla(SCI_GETTEXTLENGTH); } // Remove any selected text. void QsciScintilla::removeSelectedText() { SendScintilla(SCI_REPLACESEL, ""); } // Return the current selected text. QString QsciScintilla::selectedText() const { if (!selText) return QString(); // Scintilla doesn't tell us the length of the selected text so we use the // length of the whole document. char *buf = new char[length() + 1]; SendScintilla(SCI_GETSELTEXT, buf); QString qs = convertTextS2Q(buf); delete[] buf; return qs; } // Return the current text. QString QsciScintilla::text() const { int buflen = length() + 1; char *buf = new char[buflen]; SendScintilla(SCI_GETTEXT, buflen, buf); QString qs = convertTextS2Q(buf); delete[] buf; return qs; } // Return the text of a line. QString QsciScintilla::text(int line) const { int line_len = lineLength(line); if (line_len < 1) return QString(); char *buf = new char[line_len + 1]; SendScintilla(SCI_GETLINE, line, buf); buf[line_len] = '\0'; QString qs = convertTextS2Q(buf); delete[] buf; return qs; } // Set the given text. void QsciScintilla::setText(const QString &text) { bool ro = ensureRW(); if (isUtf8()) SendScintilla(SCI_SETTEXT, text.toUtf8().data()); else SendScintilla(SCI_SETTEXT, text.toLatin1().data()); SendScintilla(SCI_EMPTYUNDOBUFFER); setReadOnly(ro); } // Get the cursor position void QsciScintilla::getCursorPosition(int *line, int *index) const { long pos = SendScintilla(SCI_GETCURRENTPOS); long lin = SendScintilla(SCI_LINEFROMPOSITION, pos); long linpos = SendScintilla(SCI_POSITIONFROMLINE, lin); *line = lin; *index = pos - linpos; } // Set the cursor position void QsciScintilla::setCursorPosition(int line, int index) { SendScintilla(SCI_GOTOPOS, posFromLineIndex(line, index)); } // Ensure the cursor is visible. void QsciScintilla::ensureCursorVisible() { SendScintilla(SCI_SCROLLCARET); } // Ensure a line is visible. void QsciScintilla::ensureLineVisible(int line) { SendScintilla(SCI_ENSUREVISIBLEENFORCEPOLICY, line); } // Copy text to the clipboard. void QsciScintilla::copy() { SendScintilla(SCI_COPY); } // Cut text to the clipboard. void QsciScintilla::cut() { SendScintilla(SCI_CUT); } // Paste text from the clipboard. void QsciScintilla::paste() { SendScintilla(SCI_PASTE); } // Select all text, or deselect any selected text. void QsciScintilla::selectAll(bool select) { if (selText) SendScintilla(SCI_SETANCHOR, SendScintilla(SCI_GETCURRENTPOS)); else SendScintilla(SCI_SELECTALL); } // Delete all text. void QsciScintilla::clear() { bool ro = ensureRW(); SendScintilla(SCI_BEGINUNDOACTION); SendScintilla(SCI_CLEARALL); SendScintilla(SCI_ENDUNDOACTION); setReadOnly(ro); } // Return the indentation of a line. int QsciScintilla::indentation(int line) const { return SendScintilla(SCI_GETLINEINDENTATION, line); } // Set the indentation of a line. void QsciScintilla::setIndentation(int line, int indentation) { SendScintilla(SCI_BEGINUNDOACTION); SendScintilla(SCI_SETLINEINDENTATION, line, indentation); SendScintilla(SCI_ENDUNDOACTION); } // Indent a line. void QsciScintilla::indent(int line) { setIndentation(line, indentation(line) + indentWidth()); } // Unindent a line. void QsciScintilla::unindent(int line) { int newIndent = indentation(line) - indentWidth(); if (newIndent < 0) newIndent = 0; setIndentation(line, newIndent); } // Return the indentation of the current line. int QsciScintilla::currentIndent() const { return indentation(SendScintilla(SCI_LINEFROMPOSITION, SendScintilla(SCI_GETCURRENTPOS))); } // Return the current indentation width. int QsciScintilla::indentWidth() const { int w = indentationWidth(); if (w == 0) w = tabWidth(); return w; } // Return the state of indentation guides. bool QsciScintilla::indentationGuides() const { return SendScintilla(SCI_GETINDENTATIONGUIDES); } // Enable and disable indentation guides. void QsciScintilla::setIndentationGuides(bool enable) { SendScintilla(SCI_SETINDENTATIONGUIDES, enable); } // Set the background colour of indentation guides. void QsciScintilla::setIndentationGuidesBackgroundColor(const QColor &col) { SendScintilla(SCI_STYLESETBACK, STYLE_INDENTGUIDE, col); } // Set the foreground colour of indentation guides. void QsciScintilla::setIndentationGuidesForegroundColor(const QColor &col) { SendScintilla(SCI_STYLESETFORE, STYLE_INDENTGUIDE, col); } // Return the indentation width. int QsciScintilla::indentationWidth() const { return SendScintilla(SCI_GETINDENT); } // Set the indentation width. void QsciScintilla::setIndentationWidth(int width) { SendScintilla(SCI_SETINDENT, width); } // Return the tab width. int QsciScintilla::tabWidth() const { return SendScintilla(SCI_GETTABWIDTH); } // Set the tab width. void QsciScintilla::setTabWidth(int width) { SendScintilla(SCI_SETTABWIDTH, width); } // Return the effect of the backspace key. bool QsciScintilla::backspaceUnindents() const { return SendScintilla(SCI_GETBACKSPACEUNINDENTS); } // Set the effect of the backspace key. void QsciScintilla::setBackspaceUnindents(bool unindents) { SendScintilla(SCI_SETBACKSPACEUNINDENTS, unindents); } // Return the effect of the tab key. bool QsciScintilla::tabIndents() const { return SendScintilla(SCI_GETTABINDENTS); } // Set the effect of the tab key. void QsciScintilla::setTabIndents(bool indents) { SendScintilla(SCI_SETTABINDENTS, indents); } // Return the indentation use of tabs. bool QsciScintilla::indentationsUseTabs() const { return SendScintilla(SCI_GETUSETABS); } // Set the indentation use of tabs. void QsciScintilla::setIndentationsUseTabs(bool tabs) { SendScintilla(SCI_SETUSETABS, tabs); } // Return the state of line numbers in a margin. bool QsciScintilla::marginLineNumbers(int margin) const { return SendScintilla(SCI_GETMARGINTYPEN, margin); } // Enable and disable line numbers in a margin. void QsciScintilla::setMarginLineNumbers(int margin, bool lnrs) { SendScintilla(SCI_SETMARGINTYPEN, margin, lnrs ? SC_MARGIN_NUMBER : 0); } // Return the marker mask of a margin. int QsciScintilla::marginMarkerMask(int margin) const { return SendScintilla(SCI_GETMARGINMASKN, margin); } // Set the marker mask of a margin. void QsciScintilla::setMarginMarkerMask(int margin,int mask) { SendScintilla(SCI_SETMARGINMASKN, margin, mask); } // Return the state of a margin's sensitivity. bool QsciScintilla::marginSensitivity(int margin) const { return SendScintilla(SCI_GETMARGINSENSITIVEN, margin); } // Enable and disable a margin's sensitivity. void QsciScintilla::setMarginSensitivity(int margin,bool sens) { SendScintilla(SCI_SETMARGINSENSITIVEN, margin, sens); } // Return the width of a margin. int QsciScintilla::marginWidth(int margin) const { return SendScintilla(SCI_GETMARGINWIDTHN, margin); } // Set the width of a margin. void QsciScintilla::setMarginWidth(int margin, int width) { SendScintilla(SCI_SETMARGINWIDTHN, margin, width); } // Set the width of a margin to the width of some text. void QsciScintilla::setMarginWidth(int margin, const QString &s) { int width; if (isUtf8()) width = SendScintilla(SCI_TEXTWIDTH, STYLE_LINENUMBER, s.toUtf8().data()); else width = SendScintilla(SCI_TEXTWIDTH, STYLE_LINENUMBER, s.toLatin1().data()); setMarginWidth(margin, width); } // Set the background colour of all margins. void QsciScintilla::setMarginsBackgroundColor(const QColor &col) { handleStylePaperChange(col, STYLE_LINENUMBER); } // Set the foreground colour of all margins. void QsciScintilla::setMarginsForegroundColor(const QColor &col) { handleStyleColorChange(col, STYLE_LINENUMBER); } // Set the font of all margins. void QsciScintilla::setMarginsFont(const QFont &f) { setStylesFont(f, STYLE_LINENUMBER); } // Define a marker based on a symbol. int QsciScintilla::markerDefine(MarkerSymbol sym, int mnr) { checkMarker(mnr); if (mnr >= 0) SendScintilla(SCI_MARKERDEFINE, mnr,static_cast(sym)); return mnr; } // Define a marker based on a character. int QsciScintilla::markerDefine(char ch, int mnr) { checkMarker(mnr); if (mnr >= 0) SendScintilla(SCI_MARKERDEFINE, mnr, static_cast(SC_MARK_CHARACTER) + ch); return mnr; } // Define a marker based on a QPixmap. int QsciScintilla::markerDefine(const QPixmap &pm, int mnr) { checkMarker(mnr); if (mnr >= 0) SendScintilla(SCI_MARKERDEFINEPIXMAP, mnr, pm); return mnr; } // Add a marker to a line. int QsciScintilla::markerAdd(int linenr,int mnr) { if (mnr < 0 || mnr > MARKER_MAX || (allocatedMarkers & (1 << mnr)) == 0) return -1; return SendScintilla(SCI_MARKERADD, linenr, mnr); } // Get the marker mask for a line. unsigned QsciScintilla::markersAtLine(int linenr) const { return SendScintilla(SCI_MARKERGET, linenr); } // Delete a marker from a line. void QsciScintilla::markerDelete(int linenr, int mnr) { if (mnr <= MARKER_MAX) { if (mnr < 0) { unsigned am = allocatedMarkers; for (int m = 0; m <= MARKER_MAX; ++m) { if (am & 1) SendScintilla(SCI_MARKERDELETE, linenr, m); am >>= 1; } } else if (allocatedMarkers & (1 << mnr)) SendScintilla(SCI_MARKERDELETE, linenr, mnr); } } // Delete a marker from the text. void QsciScintilla::markerDeleteAll(int mnr) { if (mnr <= MARKER_MAX) { if (mnr < 0) SendScintilla(SCI_MARKERDELETEALL, -1); else if (allocatedMarkers & (1 << mnr)) SendScintilla(SCI_MARKERDELETEALL, mnr); } } // Delete a marker handle from the text. void QsciScintilla::markerDeleteHandle(int mhandle) { SendScintilla(SCI_MARKERDELETEHANDLE, mhandle); } // Return the line containing a marker instance. int QsciScintilla::markerLine(int mhandle) const { return SendScintilla(SCI_MARKERLINEFROMHANDLE, mhandle); } // Search forwards for a marker. int QsciScintilla::markerFindNext(int linenr, unsigned mask) const { return SendScintilla(SCI_MARKERNEXT, linenr, mask); } // Search backwards for a marker. int QsciScintilla::markerFindPrevious(int linenr, unsigned mask) const { return SendScintilla(SCI_MARKERPREVIOUS, linenr, mask); } // Set the marker background colour. void QsciScintilla::setMarkerBackgroundColor(const QColor &col, int mnr) { if (mnr <= MARKER_MAX) { int alpha = qAlpha(col.rgb()); if (mnr < 0) { unsigned am = allocatedMarkers; for (int m = 0; m <= MARKER_MAX; ++m) { if (am & 1) { SendScintilla(SCI_MARKERSETBACK, m, col); if (alpha < 255) SendScintilla(SCI_MARKERSETALPHA, m, alpha); } am >>= 1; } } else if (allocatedMarkers & (1 << mnr)) { SendScintilla(SCI_MARKERSETBACK, mnr, col); if (alpha < 255) SendScintilla(SCI_MARKERSETALPHA, mnr, alpha); } } } // Set the marker foreground colour. void QsciScintilla::setMarkerForegroundColor(const QColor &col, int mnr) { if (mnr <= MARKER_MAX) { if (mnr < 0) { unsigned am = allocatedMarkers; for (int m = 0; m <= MARKER_MAX; ++m) { if (am & 1) SendScintilla(SCI_MARKERSETFORE, m, col); am >>= 1; } } else if (allocatedMarkers & (1 << mnr)) SendScintilla(SCI_MARKERSETFORE, mnr, col); } } // Check a marker, allocating a marker number if necessary. void QsciScintilla::checkMarker(int &mnr) { if (mnr >= 0) { // Check the explicit marker number isn't already allocated. if (mnr > MARKER_MAX || allocatedMarkers & (1 << mnr)) mnr = -1; } else { unsigned am = allocatedMarkers; // Find the smallest unallocated marker number. for (mnr = 0; mnr <= MARKER_MAX; ++mnr) { if ((am & 1) == 0) break; am >>= 1; } } // Define the marker if it is valid. if (mnr >= 0) allocatedMarkers |= (1 << mnr); } // Reset the fold margin colours. void QsciScintilla::resetFoldMarginColors() { SendScintilla(SCI_SETFOLDMARGINHICOLOUR, 0, 0L); SendScintilla(SCI_SETFOLDMARGINCOLOUR, 0, 0L); } // Set the fold margin colours. void QsciScintilla::setFoldMarginColors(const QColor &fore, const QColor &back) { SendScintilla(SCI_SETFOLDMARGINHICOLOUR, 1, fore); SendScintilla(SCI_SETFOLDMARGINCOLOUR, 1, back); } // Set the call tips background colour. void QsciScintilla::setCallTipsBackgroundColor(const QColor &col) { SendScintilla(SCI_CALLTIPSETBACK, col); } // Set the call tips foreground colour. void QsciScintilla::setCallTipsForegroundColor(const QColor &col) { SendScintilla(SCI_CALLTIPSETFORE, col); } // Set the call tips highlight colour. void QsciScintilla::setCallTipsHighlightColor(const QColor &col) { SendScintilla(SCI_CALLTIPSETFOREHLT, col); } // Set the matched brace background colour. void QsciScintilla::setMatchedBraceBackgroundColor(const QColor &col) { SendScintilla(SCI_STYLESETBACK, STYLE_BRACELIGHT, col); } // Set the matched brace foreground colour. void QsciScintilla::setMatchedBraceForegroundColor(const QColor &col) { SendScintilla(SCI_STYLESETFORE, STYLE_BRACELIGHT, col); } // Set the unmatched brace background colour. void QsciScintilla::setUnmatchedBraceBackgroundColor(const QColor &col) { SendScintilla(SCI_STYLESETBACK, STYLE_BRACEBAD, col); } // Set the unmatched brace foreground colour. void QsciScintilla::setUnmatchedBraceForegroundColor(const QColor &col) { SendScintilla(SCI_STYLESETFORE, STYLE_BRACEBAD, col); } // Set the lexer. void QsciScintilla::setLexer(QsciLexer *lexer) { // Disconnect any previous lexer. if (!lex.isNull()) { lex->disconnect(this); SendScintilla(SCI_STYLERESETDEFAULT); } // Connect up the new lexer. lex = lexer; if (lex) { SendScintilla(SCI_SETLEXERLANGUAGE, lex->lexer()); int bits = SendScintilla(SCI_GETSTYLEBITSNEEDED); SendScintilla(SCI_SETSTYLEBITS, bits); connect(lex,SIGNAL(colorChanged(const QColor &, int)), SLOT(handleStyleColorChange(const QColor &, int))); connect(lex,SIGNAL(eolFillChanged(bool, int)), SLOT(handleStyleEolFillChange(bool, int))); connect(lex,SIGNAL(fontChanged(const QFont &, int)), SLOT(handleStyleFontChange(const QFont &, int))); connect(lex,SIGNAL(paperChanged(const QColor &, int)), SLOT(handleStylePaperChange(const QColor &, int))); connect(lex,SIGNAL(propertyChanged(const char *, const char *)), SLOT(handlePropertyChange(const char *, const char *))); // Set the keywords. Scintilla allows for sets numbered 0 to // KEYWORDSET_MAX (although the lexers only seem to exploit 0 to // KEYWORDSET_MAX - 1). We number from 1 in line with SciTE's property // files. for (int k = 0; k <= KEYWORDSET_MAX; ++k) { const char *kw = lex -> keywords(k + 1); if (kw) SendScintilla(SCI_SETKEYWORDS, k, kw); } // Initialise each style. Do the default first so its (possibly // incorrect) font setting gets reset when style 0 is set. setLexerStyle(STYLE_DEFAULT); int nrStyles = 1 << bits; for (int s = 0; s < nrStyles; ++s) if (!lex->description(s).isNull()) setLexerStyle(s); // Initialise the properties. lex->refreshProperties(); // Set the auto-completion fillups and word separators. setAutoCompletionFillupsEnabled(fillups_enabled); wseps = lex->autoCompletionWordSeparators(); wchars = lex->wordCharacters(); if (!wchars) wchars = defaultWordChars; SendScintilla(SCI_AUTOCSETIGNORECASE, !lex->caseSensitive()); } else { SendScintilla(SCI_SETLEXER, SCLEX_NULL); setColor(nl_text_colour); setPaper(nl_paper_colour); SendScintilla(SCI_AUTOCSETFILLUPS, ""); SendScintilla(SCI_AUTOCSETIGNORECASE, false); wseps.clear(); wchars = defaultWordChars; } } // Set a particular style of the current lexer. void QsciScintilla::setLexerStyle(int style) { handleStyleColorChange(lex->color(style), style); handleStyleEolFillChange(lex->eolFill(style), style); handleStyleFontChange(lex->font(style), style); handleStylePaperChange(lex->paper(style), style); } // Get the current lexer. QsciLexer *QsciScintilla::lexer() const { return lex; } // Handle a change in lexer style foreground colour. void QsciScintilla::handleStyleColorChange(const QColor &c, int style) { SendScintilla(SCI_STYLESETFORE, style, c); } // Handle a change in lexer style end-of-line fill. void QsciScintilla::handleStyleEolFillChange(bool eolfill, int style) { SendScintilla(SCI_STYLESETEOLFILLED, style, eolfill); } // Handle a change in lexer style font. void QsciScintilla::handleStyleFontChange(const QFont &f, int style) { setStylesFont(f, style); if (style == lex->braceStyle()) { setStylesFont(f, STYLE_BRACELIGHT); setStylesFont(f, STYLE_BRACEBAD); } } // Set the font for a style. void QsciScintilla::setStylesFont(const QFont &f, int style) { SendScintilla(SCI_STYLESETFONT, style, f.family().toAscii().data()); SendScintilla(SCI_STYLESETSIZE, style, f.pointSize()); SendScintilla(SCI_STYLESETBOLD, style, f.bold()); SendScintilla(SCI_STYLESETITALIC, style, f.italic()); SendScintilla(SCI_STYLESETUNDERLINE, style, f.underline()); // Tie the font settings of the default style to that of style 0 (the style // conventionally used for whitespace by lexers). This is needed so that // fold marks, indentations, edge columns etc are set properly. if (style == 0) setStylesFont(f, STYLE_DEFAULT); } // Handle a change in lexer style background colour. void QsciScintilla::handleStylePaperChange(const QColor &c, int style) { SendScintilla(SCI_STYLESETBACK, style, c); } // Handle a change in lexer property. void QsciScintilla::handlePropertyChange(const char *prop, const char *val) { SendScintilla(SCI_SETPROPERTY, prop, val); } // Handle a change to the user visible user interface. void QsciScintilla::handleUpdateUI() { int newPos = SendScintilla(SCI_GETCURRENTPOS); if (newPos != oldPos) { oldPos = newPos; int line = SendScintilla(SCI_LINEFROMPOSITION, newPos); int col = SendScintilla(SCI_GETCOLUMN, newPos); emit cursorPositionChanged(line, col); } if (braceMode != NoBraceMatch) braceMatch(); } // Handle brace matching. void QsciScintilla::braceMatch() { long braceAtCaret, braceOpposite; findMatchingBrace(braceAtCaret, braceOpposite, braceMode); if (braceAtCaret >= 0 && braceOpposite < 0) { SendScintilla(SCI_BRACEBADLIGHT, braceAtCaret); SendScintilla(SCI_SETHIGHLIGHTGUIDE, 0UL); } else { char chBrace = SendScintilla(SCI_GETCHARAT, braceAtCaret); SendScintilla(SCI_BRACEHIGHLIGHT, braceAtCaret, braceOpposite); long columnAtCaret = SendScintilla(SCI_GETCOLUMN, braceAtCaret); long columnOpposite = SendScintilla(SCI_GETCOLUMN, braceOpposite); if (chBrace == ':') { long lineStart = SendScintilla(SCI_LINEFROMPOSITION, braceAtCaret); long indentPos = SendScintilla(SCI_GETLINEINDENTPOSITION, lineStart); long indentPosNext = SendScintilla(SCI_GETLINEINDENTPOSITION, lineStart + 1); columnAtCaret = SendScintilla(SCI_GETCOLUMN, indentPos); long columnAtCaretNext = SendScintilla(SCI_GETCOLUMN, indentPosNext); long indentSize = SendScintilla(SCI_GETINDENT); if (columnAtCaretNext - indentSize > 1) columnAtCaret = columnAtCaretNext - indentSize; if (columnOpposite == 0) columnOpposite = columnAtCaret; } long column = columnAtCaret; if (column > columnOpposite) column = columnOpposite; SendScintilla(SCI_SETHIGHLIGHTGUIDE, column); } } // Check if the character at a position is a brace. long QsciScintilla::checkBrace(long pos, int brace_style, bool &colonMode) { long brace_pos = -1; char ch = SendScintilla(SCI_GETCHARAT, pos); if (ch == ':') { // A bit of a hack. if (!lex.isNull() && qstrcmp(lex->lexer(), "python") == 0) { brace_pos = pos; colonMode = true; } } else if (ch && strchr("[](){}<>", ch)) { if (brace_style < 0) brace_pos = pos; else { int style = SendScintilla(SCI_GETSTYLEAT, pos) & 0x1f; if (style == brace_style) brace_pos = pos; } } return brace_pos; } // Find a brace and it's match. Return true if the current position is inside // a pair of braces. bool QsciScintilla::findMatchingBrace(long &brace, long &other,BraceMatch mode) { bool colonMode = false; int brace_style = (lex.isNull() ? -1 : lex->braceStyle()); brace = -1; other = -1; long caretPos = SendScintilla(SCI_GETCURRENTPOS); if (caretPos > 0) brace = checkBrace(caretPos - 1, brace_style, colonMode); bool isInside = false; if (brace < 0 && mode == SloppyBraceMatch) { brace = checkBrace(caretPos, brace_style, colonMode); if (brace >= 0 && !colonMode) isInside = true; } if (brace >= 0) { if (colonMode) { // Find the end of the Python indented block. long lineStart = SendScintilla(SCI_LINEFROMPOSITION, brace); long lineMaxSubord = SendScintilla(SCI_GETLASTCHILD, lineStart, -1); other = SendScintilla(SCI_GETLINEENDPOSITION, lineMaxSubord); } else other = SendScintilla(SCI_BRACEMATCH, brace); if (other > brace) isInside = !isInside; } return isInside; } // Move to the matching brace. void QsciScintilla::moveToMatchingBrace() { gotoMatchingBrace(false); } // Select to the matching brace. void QsciScintilla::selectToMatchingBrace() { gotoMatchingBrace(true); } // Move to the matching brace and optionally select the text. void QsciScintilla::gotoMatchingBrace(bool select) { long braceAtCaret; long braceOpposite; bool isInside = findMatchingBrace(braceAtCaret, braceOpposite, SloppyBraceMatch); if (braceOpposite >= 0) { // Convert the character positions into caret positions based on // whether the caret position was inside or outside the braces. if (isInside) { if (braceOpposite > braceAtCaret) braceAtCaret++; else braceOpposite++; } else { if (braceOpposite > braceAtCaret) braceOpposite++; else braceAtCaret++; } ensureLineVisible(SendScintilla(SCI_LINEFROMPOSITION, braceOpposite)); if (select) SendScintilla(SCI_SETSEL, braceAtCaret, braceOpposite); else SendScintilla(SCI_SETSEL, braceOpposite, braceOpposite); } } // Return a position from a line number and an index within the line. long QsciScintilla::posFromLineIndex(int line, int index) const { long pos = SendScintilla(SCI_POSITIONFROMLINE, line); // Allow for multi-byte characters. for(int i = 0; i < index; i++) pos = SendScintilla(SCI_POSITIONAFTER, pos); return pos; } // Return a line number and an index within the line from a position. void QsciScintilla::lineIndexFromPos(long pos, int *line, int *index) const { long lin = SendScintilla(SCI_LINEFROMPOSITION, pos); long linpos = SendScintilla(SCI_POSITIONFROMLINE, lin); *line = lin; *index = pos - linpos; } // Convert a Scintilla string to a Qt Unicode string. QString QsciScintilla::convertTextS2Q(const char *s) const { if (isUtf8()) return QString::fromUtf8(s); return QString::fromLatin1(s); } // Set the source of the automatic auto-completion list. void QsciScintilla::setAutoCompletionSource(AutoCompletionSource source) { acSource = source; } // Set the threshold for automatic auto-completion. void QsciScintilla::setAutoCompletionThreshold(int thresh) { acThresh = thresh; } // Set the auto-completion word separators if there is no current lexer. void QsciScintilla::setAutoCompletionWordSeparators(const QStringList &separators) { if (lex.isNull()) wseps = separators; } // Explicitly auto-complete from all sources. void QsciScintilla::autoCompleteFromAll() { startAutoCompletion(AcsAll, false, showSingle); } // Explicitly auto-complete from the APIs. void QsciScintilla::autoCompleteFromAPIs() { startAutoCompletion(AcsAPIs, false, showSingle); } // Explicitly auto-complete from the document. void QsciScintilla::autoCompleteFromDocument() { startAutoCompletion(AcsDocument, false, showSingle); } // Check if a character can be in a word. bool QsciScintilla::isWordCharacter(char ch) const { return (strchr(wchars, ch) != NULL); } // Return the set of valid word characters. const char *QsciScintilla::wordCharacters() const { return wchars; } // Recolour the document. void QsciScintilla::recolor(int start, int end) { SendScintilla(SCI_COLOURISE, start, end); } // Registered an image. void QsciScintilla::registerImage(int id, const QPixmap &pm) { SendScintilla(SCI_REGISTERIMAGE, id, pm); } // Clear all registered images. void QsciScintilla::clearRegisteredImages() { SendScintilla(SCI_CLEARREGISTEREDIMAGES); } // Enable auto-completion fill-ups. void QsciScintilla::setAutoCompletionFillupsEnabled(bool enable) { const char *fillups; if (!enable) fillups = ""; else if (!lex.isNull()) fillups = lex->autoCompletionFillups(); else fillups = explicit_fillups.data(); SendScintilla(SCI_AUTOCSETFILLUPS, fillups); fillups_enabled = enable; } // See if auto-completion fill-ups are enabled. bool QsciScintilla::autoCompletionFillupsEnabled() const { return fillups_enabled; } // Set the fill-up characters for auto-completion if there is no current lexer. void QsciScintilla::setAutoCompletionFillups(const char *fillups) { explicit_fillups = fillups; setAutoCompletionFillupsEnabled(fillups_enabled); } // Set the case sensitivity for auto-completion if there is no current lexer. void QsciScintilla::setAutoCompletionCaseSensitivity(bool cs) { if (lex.isNull()) SendScintilla(SCI_AUTOCSETIGNORECASE, !cs); } // Return the case sensitivity for auto-completion. bool QsciScintilla::autoCompletionCaseSensitivity() const { return !SendScintilla(SCI_AUTOCGETIGNORECASE); } // Set the replace word mode for auto-completion. void QsciScintilla::setAutoCompletionReplaceWord(bool replace) { SendScintilla(SCI_AUTOCSETDROPRESTOFWORD, replace); } // Return the replace word mode for auto-completion. bool QsciScintilla::autoCompletionReplaceWord() const { return SendScintilla(SCI_AUTOCGETDROPRESTOFWORD); } // Set the single item mode for auto-completion. void QsciScintilla::setAutoCompletionShowSingle(bool single) { showSingle = single; } // Return the single item mode for auto-completion. bool QsciScintilla::autoCompletionShowSingle() const { return showSingle; } // Set current call tip style. void QsciScintilla::setCallTipsStyle(CallTipsStyle style) { call_tips_style = style; } // Set maximum number of call tips displayed. void QsciScintilla::setCallTipsVisible(int nr) { maxCallTips = nr; } // Set the document to display. void QsciScintilla::setDocument(const QsciDocument &document) { if (doc.pdoc != document.pdoc) { doc.undisplay(this); doc.attach(document); doc.display(this,&document); } } // Ensure the document is read-write and return true if was was read-only. bool QsciScintilla::ensureRW() { bool ro = isReadOnly(); if (ro) setReadOnly(false); return ro; } // Return the number of the first visible line. int QsciScintilla::firstVisibleLine() const { return SendScintilla(SCI_GETFIRSTVISIBLELINE); } // Return the height in pixels of the text in a particular line. int QsciScintilla::textHeight(int linenr) const { return SendScintilla(SCI_TEXTHEIGHT, linenr); } // See if auto-completion or user list is active. bool QsciScintilla::isListActive() const { return SendScintilla(SCI_AUTOCACTIVE); } // Cancel any current auto-completion or user list. void QsciScintilla::cancelList() { SendScintilla(SCI_AUTOCCANCEL); } // Handle a selection from the auto-completion list. void QsciScintilla::handleAutoCompletionSelection() { if (!lex.isNull()) { QsciAPIs *apis = lex->apis(); if (apis) apis->autoCompletionSelected(ListBoxQt::backdoor); } } // Display a user list. void QsciScintilla::showUserList(int id, const QStringList &list) { // Sanity check to make sure auto-completion doesn't get confused. if (id <= 0) return; const char sep = '\x03'; SendScintilla(SCI_AUTOCSETSEPARATOR, sep); SendScintilla(SCI_USERLISTSHOW, id, list.join(QChar(sep)).toLatin1().data()); } // Translate the SCN_USERLISTSELECTION notification into something more useful. void QsciScintilla::handleUserListSelection(const char *text, int id) { emit userListActivated(id, QString(text)); } // Return the case sensitivity of any lexer. bool QsciScintilla::caseSensitive() const { return lex.isNull() ? true : lex->caseSensitive(); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerproperties.cpp0000644000175000001440000001007611407213302024630 0ustar subzerousers// This module implements the QsciLexerProperties class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerproperties.h" #include #include #include // The ctor. QsciLexerProperties::QsciLexerProperties(QObject *parent) : QsciLexer(parent), fold_compact(true) { } // The dtor. QsciLexerProperties::~QsciLexerProperties() { } // Returns the language name. const char *QsciLexerProperties::language() const { return "Properties"; } // Returns the lexer name. const char *QsciLexerProperties::lexer() const { return "props"; } // Return the string of characters that comprise a word. const char *QsciLexerProperties::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"; } // Returns the foreground colour of the text for a style. QColor QsciLexerProperties::defaultColor(int style) const { switch (style) { case Comment: return QColor(0x00,0x7f,0x7f); case Section: return QColor(0x7f,0x00,0x7f); case Assignment: return QColor(0xb0,0x60,0x00); case DefaultValue: return QColor(0x7f,0x7f,0x00); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerProperties::defaultEolFill(int style) const { if (style == Section) return true; return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerProperties::defaultFont(int style) const { QFont f; if (style == Comment) #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif else f = QsciLexer::defaultFont(style); return f; } // Returns the user name of a style. QString QsciLexerProperties::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case Section: return tr("Section"); case Assignment: return tr("Assignment"); case DefaultValue: return tr("Default value"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerProperties::defaultPaper(int style) const { if (style == Section) return QColor(0xe0,0xf0,0xf0); return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerProperties::refreshProperties() { setCompactProp(); } // Read properties from the settings. bool QsciLexerProperties::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_compact = qs.value(prefix + "foldcompact", true).toBool(); return rc; } // Write properties to the settings. bool QsciLexerProperties::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldcompact", fold_compact); return rc; } // Return true if folds are compact. bool QsciLexerProperties::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerProperties::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerProperties::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qsciprinter.cpp0000644000175000001440000001114411407213302023054 0ustar subzerousers// This module implements the QsciPrinter class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qsciprinter.h" #include #include #include #include "Qsci/qsciscintillabase.h" // The ctor. QsciPrinter::QsciPrinter(QPrinter::PrinterMode mode) : QPrinter(mode), mag(0), wrap(QsciScintilla::WrapWord) { } // The dtor. QsciPrinter::~QsciPrinter() { } // Format the page before the document text is drawn. void QsciPrinter::formatPage(QPainter &, bool, QRect &, int) { } // Print a range of lines to a printer. int QsciPrinter::printRange(QsciScintillaBase *qsb, int from, int to) { // Sanity check. if (!qsb) return false; // Setup the printing area. QRect def_area; def_area.setX(0); def_area.setY(0); def_area.setWidth(width()); def_area.setHeight(height()); // Get the page range. int pgFrom, pgTo; pgFrom = fromPage(); pgTo = toPage(); // Find the position range. long startPos, endPos; endPos = qsb->SendScintilla(QsciScintillaBase::SCI_GETLENGTH); startPos = (from > 0 ? qsb -> SendScintilla(QsciScintillaBase::SCI_POSITIONFROMLINE,from) : 0); if (to >= 0) { long toPos = qsb -> SendScintilla(QsciScintillaBase::SCI_POSITIONFROMLINE,to + 1); if (endPos > toPos) endPos = toPos; } if (startPos >= endPos) return false; QPainter painter(this); bool reverse = (pageOrder() == LastPageFirst); bool needNewPage = false; qsb -> SendScintilla(QsciScintillaBase::SCI_SETPRINTMAGNIFICATION,mag); qsb -> SendScintilla(QsciScintillaBase::SCI_SETPRINTWRAPMODE,wrap); for (int i = 1; i <= numCopies(); ++i) { // If we are printing in reverse page order then remember the start // position of each page. QStack pageStarts; int currPage = 1; long pos = startPos; while (pos < endPos) { // See if we have finished the requested page range. if (pgTo > 0 && pgTo < currPage) break; // See if we are going to render this page, or just see how much // would fit onto it. bool render = false; if (pgFrom == 0 || pgFrom <= currPage) { if (reverse) pageStarts.push(pos); else { render = true; if (needNewPage) { if (!newPage()) return false; } else needNewPage = true; } } QRect area = def_area; formatPage(painter,render,area,currPage); pos = qsb -> SendScintilla(QsciScintillaBase::SCI_FORMATRANGE,render,&painter,area,pos,endPos); ++currPage; } // All done if we are printing in normal page order. if (!reverse) continue; // Now go through each page on the stack and really print it. while (!pageStarts.isEmpty()) { --currPage; long ePos = pos; pos = pageStarts.pop(); if (needNewPage) { if (!newPage()) return false; } else needNewPage = true; QRect area = def_area; formatPage(painter,true,area,currPage); qsb->SendScintilla(QsciScintillaBase::SCI_FORMATRANGE,true,&painter,area,pos,ePos); } } return true; } // Set the print magnification in points. void QsciPrinter::setMagnification(int magnification) { mag = magnification; } // Set the line wrap mode. void QsciPrinter::setWrapMode(QsciScintilla::WrapMode wmode) { wrap = wmode; } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/ScintillaQt.h0000644000175000001440000000605411407213302022411 0ustar subzerousers// The definition of the Qt specific subclass of ScintillaBase. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef SCINTILLAQT_H #define SCINTILLAQT_H #include #include // These are needed because scintilla class header files don't seem to manage // their own dependencies properly. #include #include #include "Platform.h" #include "Scintilla.h" #include "SVector.h" #include "SplitVector.h" #include "Partitioning.h" #include "CellBuffer.h" #include "CharClassify.h" #include "RunStyles.h" #include "Decoration.h" #include "Document.h" #include "Style.h" #include "XPM.h" #include "LineMarker.h" #include "Indicator.h" #include "ViewStyle.h" #include "KeyMap.h" #include "ContractionState.h" #include "PositionCache.h" #include "Editor.h" #include "AutoComplete.h" #include "CallTip.h" #include "SString.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "ScintillaBase.h" class QPaintEvent; class QDropEvent; class QsciScintillaBase; class SciCallTip; class SciPopup; class ScintillaQt : public ScintillaBase { friend class QsciScintillaBase; friend class SciCallTip; friend class SciPopup; public: ScintillaQt(QsciScintillaBase *qsb_); virtual ~ScintillaQt(); virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); private: void Initialise(); void Finalise(); void StartDrag(); sptr_t DefWndProc(unsigned int, uptr_t, sptr_t); void SetTicking(bool); void SetMouseCapture(bool on); bool HaveMouseCapture(); void SetVerticalScrollPos(); void SetHorizontalScrollPos(); bool ModifyScrollBars(int nMax, int nPage); void ReconfigureScrollBars(); void NotifyChange(); void NotifyParent(SCNotification scn); void CopyToClipboard(const SelectionText &selectedText); void Copy(); void Paste(); void CreateCallTipWindow(PRectangle rc); void AddToPopUp(const char *label, int cmd = 0, bool enabled = true); void ClaimSelection(); void UnclaimSelection(); static sptr_t DirectFunction(ScintillaQt *sci, unsigned int iMessage, uptr_t wParam,sptr_t lParam); QString textRange(const SelectionText *text); void paintEvent(QPaintEvent *e); void pasteFromClipboard(QClipboard::Mode mode); bool capturedMouse; QsciScintillaBase *qsb; QTimer qtimer; }; #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexersql.cpp0000644000175000001440000002525511407213302023240 0ustar subzerousers// This module implements the QsciLexerSQL class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexersql.h" #include #include #include // The ctor. QsciLexerSQL::QsciLexerSQL(QObject *parent) : QsciLexer(parent), fold_comments(false), fold_compact(true), backslash_escapes(false) { } // The dtor. QsciLexerSQL::~QsciLexerSQL() { } // Returns the language name. const char *QsciLexerSQL::language() const { return "SQL"; } // Returns the lexer name. const char *QsciLexerSQL::lexer() const { return "sql"; } // Return the style used for braces. int QsciLexerSQL::braceStyle() const { return Operator; } // Returns the foreground colour of the text for a style. QColor QsciLexerSQL::defaultColor(int style) const { switch (style) { case Default: return QColor(0x80,0x80,0x80); case Comment: case CommentLine: case PlusPrompt: case PlusComment: case CommentLineHash: return QColor(0x00,0x7f,0x00); case CommentDoc: return QColor(0x7f,0x7f,0x7f); case Number: return QColor(0x00,0x7f,0x7f); case Keyword: return QColor(0x00,0x00,0x7f); case DoubleQuotedString: case SingleQuotedString: return QColor(0x7f,0x00,0x7f); case PlusKeyword: return QColor(0x7f,0x7f,0x00); case Operator: case Identifier: break; case CommentDocKeyword: return QColor(0x30,0x60,0xa0); case CommentDocKeywordError: return QColor(0x80,0x40,0x20); case KeywordSet5: return QColor(0x4b,0x00,0x82); case KeywordSet6: return QColor(0xb0,0x00,0x40); case KeywordSet7: return QColor(0x8b,0x00,0x00); case KeywordSet8: return QColor(0x80,0x00,0x80); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerSQL::defaultEolFill(int style) const { if (style == PlusPrompt) return true; return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerSQL::defaultFont(int style) const { QFont f; switch (style) { case Comment: case CommentLine: case PlusComment: case CommentLineHash: case CommentDocKeyword: case CommentDocKeywordError: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case Keyword: case Operator: f = QsciLexer::defaultFont(style); f.setBold(true); break; case DoubleQuotedString: case SingleQuotedString: case PlusPrompt: #if defined(Q_OS_WIN) f = QFont("Courier New",10); #else f = QFont("Bitstream Vera Sans Mono",9); #endif break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerSQL::keywords(int set) const { if (set == 1) return "absolute action add admin after aggregate alias all " "allocate alter and any are array as asc assertion " "at authorization before begin binary bit blob " "boolean both breadth by call cascade cascaded case " "cast catalog char character check class clob close " "collate collation column commit completion connect " "connection constraint constraints constructor " "continue corresponding create cross cube current " "current_date current_path current_role current_time " "current_timestamp current_user cursor cycle data " "date day deallocate dec decimal declare default " "deferrable deferred delete depth deref desc " "describe descriptor destroy destructor " "deterministic dictionary diagnostics disconnect " "distinct domain double drop dynamic each else end " "end-exec equals escape every except exception exec " "execute external false fetch first float for " "foreign found from free full function general get " "global go goto grant group grouping having host " "hour identity if ignore immediate in indicator " "initialize initially inner inout input insert int " "integer intersect interval into is isolation " "iterate join key language large last lateral " "leading left less level like limit local localtime " "localtimestamp locator map match minute modifies " "modify module month names national natural nchar " "nclob new next no none not null numeric object of " "off old on only open operation option or order " "ordinality out outer output pad parameter " "parameters partial path postfix precision prefix " "preorder prepare preserve primary prior privileges " "procedure public read reads real recursive ref " "references referencing relative restrict result " "return returns revoke right role rollback rollup " "routine row rows savepoint schema scroll scope " "search second section select sequence session " "session_user set sets size smallint some| space " "specific specifictype sql sqlexception sqlstate " "sqlwarning start state statement static structure " "system_user table temporary terminate than then " "time timestamp timezone_hour timezone_minute to " "trailing transaction translation treat trigger " "true under union unique unknown unnest update usage " "user using value values varchar variable varying " "view when whenever where with without work write " "year zone"; if (set == 4) return "acc~ept a~ppend archive log attribute bre~ak " "bti~tle c~hange cl~ear col~umn comp~ute conn~ect " "copy def~ine del desc~ribe disc~onnect e~dit " "exec~ute exit get help ho~st i~nput l~ist passw~ord " "pau~se pri~nt pro~mpt quit recover rem~ark " "repf~ooter reph~eader r~un sav~e set sho~w shutdown " "spo~ol sta~rt startup store timi~ng tti~tle " "undef~ine var~iable whenever oserror whenever " "sqlerror"; return 0; } // Returns the user name of a style. QString QsciLexerSQL::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case CommentLine: return tr("Comment line"); case CommentDoc: return tr("JavaDoc style comment"); case Number: return tr("Number"); case Keyword: return tr("Keyword"); case DoubleQuotedString: return tr("Double-quoted string"); case SingleQuotedString: return tr("Single-quoted string"); case PlusKeyword: return tr("SQL*Plus keyword"); case PlusPrompt: return tr("SQL*Plus prompt"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case PlusComment: return tr("SQL*Plus comment"); case CommentLineHash: return tr("# comment line"); case CommentDocKeyword: return tr("JavaDoc keyword"); case CommentDocKeywordError: return tr("JavaDoc keyword error"); case KeywordSet5: return tr("User defined 1"); case KeywordSet6: return tr("User defined 2"); case KeywordSet7: return tr("User defined 3"); case KeywordSet8: return tr("User defined 4"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerSQL::defaultPaper(int style) const { if (style == PlusPrompt) return QColor(0xe0,0xff,0xe0); return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerSQL::refreshProperties() { setCommentProp(); setCompactProp(); setBackslashEscapesProp(); } // Read properties from the settings. bool QsciLexerSQL::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_comments = qs.value(prefix + "foldcomments", false).toBool(); fold_compact = qs.value(prefix + "foldcompact", true).toBool(); backslash_escapes = qs.value(prefix + "backslashescapes", false).toBool(); return rc; } // Write properties to the settings. bool QsciLexerSQL::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.value(prefix + "foldcomments", fold_comments); qs.value(prefix + "foldcompact", fold_compact); qs.value(prefix + "backslashescapes", backslash_escapes); return rc; } // Return true if comments can be folded. bool QsciLexerSQL::foldComments() const { return fold_comments; } // Set if comments can be folded. void QsciLexerSQL::setFoldComments(bool fold) { fold_comments = fold; setCommentProp(); } // Set the "fold.comment" property. void QsciLexerSQL::setCommentProp() { emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); } // Return true if folds are compact. bool QsciLexerSQL::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerSQL::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerSQL::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } // Return true if backslash escapes are enabled. bool QsciLexerSQL::backslashEscapes() const { return backslash_escapes; } // Enable/disable backslash escapes. void QsciLexerSQL::setBackslashEscapes(bool enable) { backslash_escapes = enable; setBackslashEscapesProp(); } // Set the "sql.backslash.escapes" property. void QsciLexerSQL::setBackslashEscapesProp() { emit propertyChanged("sql.backslash.escapes",(backslash_escapes ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/SciClasses.cpp0000644000175000001440000000734211407213302022552 0ustar subzerousers// The implementation of various Qt version independent classes used by the // rest of the port. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "SciClasses.h" #include #include #include "ScintillaQt.h" #include "ListBoxQt.h" // Create a call tip. SciCallTip::SciCallTip(QWidget *parent, ScintillaQt *sci_) : QWidget(parent, Qt::WindowFlags(Qt::Popup|Qt::FramelessWindowHint|Qt::WA_StaticContents)), sci(sci_) { // Ensure that the main window keeps the focus (and the caret flashing) // when this is displayed. setFocusProxy(parent); } // Destroy a call tip. SciCallTip::~SciCallTip() { // Ensure that the main window doesn't receive a focus out event when // this is destroyed. setFocusProxy(0); } // Paint a call tip. void SciCallTip::paintEvent(QPaintEvent *) { Surface *surfaceWindow = Surface::Allocate(); if (!surfaceWindow) return; QPainter p(this); surfaceWindow->Init(&p); sci->ct.PaintCT(surfaceWindow); delete surfaceWindow; } // Handle a mouse press in a call tip. void SciCallTip::mousePressEvent(QMouseEvent *e) { Point pt; pt.x = e->x(); pt.y = e->y(); sci->ct.MouseClick(pt); sci->CallTipClick(); } // Create the popup instance. SciPopup::SciPopup() { // Set up the mapper. connect(&mapper, SIGNAL(mapped(int)), this, SLOT(on_triggered(int))); } // Add an item and associated command to the popup and enable it if required. void SciPopup::addItem(const QString &label, int cmd, bool enabled, ScintillaQt *sci_) { QAction *act = addAction(label, &mapper, SLOT(map())); mapper.setMapping(act, cmd); act->setEnabled(enabled); sci = sci_; } // A slot to handle a menu action being triggered. void SciPopup::on_triggered(int cmd) { sci->Command(cmd); } #include SciListBox::SciListBox(QWidget *parent, ListBoxQt *lbx_) : QListWidget(parent), lbx(lbx_) { setWindowFlags(Qt::WindowFlags(Qt::Popup|Qt::FramelessWindowHint|Qt::WA_StaticContents)); setFocusProxy(parent); setFrameShape(StyledPanel); setFrameShadow(Plain); connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem *)), SLOT(handleDoubleClick())); } void SciListBox::addItemPixmap(const QPixmap &pm, const QString &txt) { new QListWidgetItem(pm, txt, this); } int SciListBox::find(const QString &prefix) { QList itms = findItems(prefix, Qt::MatchStartsWith|Qt::MatchCaseSensitive); if (itms.size() == 0) return -1; return row(itms[0]); } QString SciListBox::text(int n) { QListWidgetItem *itm = item(n); if (!itm) return QString(); return itm->text(); } SciListBox::~SciListBox() { // Ensure that the main widget doesn't get a focus out event when this is // destroyed. setFocusProxy(0); } void SciListBox::handleDoubleClick() { if (lbx && lbx->cb_action) lbx->cb_action(lbx->cb_data); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscicommandset.cpp0000644000175000001440000004576211407213302023540 0ustar subzerousers// This module implements the QsciCommandSet class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscicommandset.h" #include #include "Qsci/qsciscintilla.h" #include "Qsci/qsciscintillabase.h" // The ctor. QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs) { struct sci_cmd { int msg; int key; int altkey; const char *desc; }; // This is based on the default table in src/KeyMap.cxx. static struct sci_cmd cmd_table[] = { { QsciScintillaBase::SCI_LINEDOWN, Qt::Key_Down, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move down one line") }, { QsciScintillaBase::SCI_LINEDOWNEXTEND, Qt::Key_Down | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection down one line") }, { QsciScintillaBase::SCI_LINESCROLLDOWN, Qt::Key_Down | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Scroll view down one line") }, { QsciScintillaBase::SCI_LINEDOWNRECTEXTEND, Qt::Key_Down | Qt::ALT | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend rectangular selection down one line") }, { QsciScintillaBase::SCI_LINEUP, Qt::Key_Up, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move up one line") }, { QsciScintillaBase::SCI_LINEUPEXTEND, Qt::Key_Up | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection up one line") }, { QsciScintillaBase::SCI_LINESCROLLUP, Qt::Key_Up | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Scroll view up one line") }, { QsciScintillaBase::SCI_LINEUPRECTEXTEND, Qt::Key_Up | Qt::ALT | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend rectangular selection up one line") }, { QsciScintillaBase::SCI_PARAUP, Qt::Key_BracketLeft | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move up one paragraph") }, { QsciScintillaBase::SCI_PARAUPEXTEND, Qt::Key_BracketLeft | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection up one paragraph") }, { QsciScintillaBase::SCI_PARADOWN, Qt::Key_BracketRight | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move down one paragraph") }, { QsciScintillaBase::SCI_PARADOWNEXTEND, Qt::Key_BracketRight | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection down one paragraph") }, { QsciScintillaBase::SCI_CHARLEFT, Qt::Key_Left, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move left one character") }, { QsciScintillaBase::SCI_CHARLEFTEXTEND, Qt::Key_Left | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection left one character") }, { QsciScintillaBase::SCI_WORDLEFT, Qt::Key_Left | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move left one word") }, { QsciScintillaBase::SCI_WORDLEFTEXTEND, Qt::Key_Left | Qt::SHIFT | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection left one word") }, { QsciScintillaBase::SCI_CHARLEFTRECTEXTEND, Qt::Key_Left | Qt::ALT | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend rectangular selection left one character") }, { QsciScintillaBase::SCI_CHARRIGHT, Qt::Key_Right, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move right one character") }, { QsciScintillaBase::SCI_CHARRIGHTEXTEND, Qt::Key_Right | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection right one character") }, { QsciScintillaBase::SCI_WORDRIGHT, Qt::Key_Right | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move right one word") }, { QsciScintillaBase::SCI_WORDRIGHTEXTEND, Qt::Key_Right | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection right one word") }, { QsciScintillaBase::SCI_CHARRIGHTRECTEXTEND, Qt::Key_Right | Qt::ALT | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend rectangular selection right one character") }, { QsciScintillaBase::SCI_WORDPARTLEFT, Qt::Key_Slash | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move left one word part") }, { QsciScintillaBase::SCI_WORDPARTLEFTEXTEND, Qt::Key_Slash | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection left one word part") }, { QsciScintillaBase::SCI_WORDPARTRIGHT, Qt::Key_Backslash | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move right one word part") }, { QsciScintillaBase::SCI_WORDPARTRIGHTEXTEND, Qt::Key_Backslash | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection right one word part") }, { QsciScintillaBase::SCI_VCHOME, Qt::Key_Home, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move to first visible character in line") }, { QsciScintillaBase::SCI_VCHOMEEXTEND, Qt::Key_Home | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection to first visible character in line") }, { QsciScintillaBase::SCI_DOCUMENTSTART, Qt::Key_Home | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move to start of text") }, { QsciScintillaBase::SCI_DOCUMENTSTARTEXTEND, Qt::Key_Home | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection to start of text") }, { QsciScintillaBase::SCI_HOMEDISPLAY, Qt::Key_Home | Qt::ALT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move to start of displayed line") }, { QsciScintillaBase::SCI_HOMEDISPLAYEXTEND, 0, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection to start of line") }, { QsciScintillaBase::SCI_VCHOMERECTEXTEND, Qt::Key_Home | Qt::ALT | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend rectangular selection to first visible character in line") }, { QsciScintillaBase::SCI_LINEEND, Qt::Key_End, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move to end of line") }, { QsciScintillaBase::SCI_LINEENDEXTEND, Qt::Key_End | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection to end of line") }, { QsciScintillaBase::SCI_DOCUMENTEND, Qt::Key_End | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move to end of text") }, { QsciScintillaBase::SCI_DOCUMENTENDEXTEND, Qt::Key_End | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection to end of text") }, { QsciScintillaBase::SCI_LINEENDDISPLAY, Qt::Key_End | Qt::ALT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move to end of displayed line") }, { QsciScintillaBase::SCI_LINEENDDISPLAYEXTEND, 0, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection to end of displayed line") }, { QsciScintillaBase::SCI_LINEENDRECTEXTEND, Qt::Key_End | Qt::ALT | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend rectangular selection to end of line") }, { QsciScintillaBase::SCI_PAGEUP, Qt::Key_PageUp, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move up one page") }, { QsciScintillaBase::SCI_PAGEUPEXTEND, Qt::Key_PageUp | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection up one page") }, { QsciScintillaBase::SCI_PAGEUPRECTEXTEND, Qt::Key_PageUp | Qt::ALT | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend rectangular selection up one page") }, { QsciScintillaBase::SCI_PAGEDOWN, Qt::Key_PageDown, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move down one page") }, { QsciScintillaBase::SCI_PAGEDOWNEXTEND, Qt::Key_PageDown | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend selection down one page") }, { QsciScintillaBase::SCI_PAGEDOWNRECTEXTEND, Qt::Key_PageDown | Qt::ALT | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Extend rectangular selection down one page") }, { QsciScintillaBase::SCI_CLEAR, Qt::Key_Delete, 0, QT_TRANSLATE_NOOP("QsciCommand", "Delete current character") }, { QsciScintillaBase::SCI_CUT, Qt::Key_X | Qt::CTRL, Qt::Key_Delete | Qt::SHIFT, QT_TRANSLATE_NOOP("QsciCommand", "Cut selection") }, { QsciScintillaBase::SCI_DELWORDRIGHT, Qt::Key_Delete | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Delete word to right") }, { QsciScintillaBase::SCI_DELLINERIGHT, Qt::Key_Delete | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Delete line to right") }, { QsciScintillaBase::SCI_EDITTOGGLEOVERTYPE, Qt::Key_Insert, 0, QT_TRANSLATE_NOOP("QsciCommand", "Toggle insert/overtype") }, { QsciScintillaBase::SCI_PASTE, Qt::Key_V | Qt::CTRL, Qt::Key_Insert | Qt::SHIFT, QT_TRANSLATE_NOOP("QsciCommand", "Paste") }, { QsciScintillaBase::SCI_COPY, Qt::Key_C | Qt::CTRL, Qt::Key_Insert | Qt::CTRL, QT_TRANSLATE_NOOP("QsciCommand", "Copy selection") }, { QsciScintillaBase::SCI_CANCEL, Qt::Key_Escape, 0, QT_TRANSLATE_NOOP("QsciCommand", "Cancel") }, { QsciScintillaBase::SCI_DELETEBACK, Qt::Key_Backspace, Qt::Key_Backspace | Qt::SHIFT, QT_TRANSLATE_NOOP("QsciCommand", "Delete previous character") }, { QsciScintillaBase::SCI_DELWORDLEFT, Qt::Key_Backspace | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Delete word to left") }, { QsciScintillaBase::SCI_UNDO, Qt::Key_Z | Qt::CTRL, Qt::Key_Backspace | Qt::ALT, QT_TRANSLATE_NOOP("QsciCommand", "Undo the last command") }, { QsciScintillaBase::SCI_DELLINELEFT, Qt::Key_Backspace | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Delete line to left") }, { QsciScintillaBase::SCI_REDO, Qt::Key_Y | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Redo last command") }, { QsciScintillaBase::SCI_SELECTALL, Qt::Key_A | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Select all text") }, { QsciScintillaBase::SCI_TAB, Qt::Key_Tab, 0, QT_TRANSLATE_NOOP("QsciCommand", "Indent one level") }, { QsciScintillaBase::SCI_BACKTAB, Qt::Key_Tab | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Move back one indentation level") }, { QsciScintillaBase::SCI_NEWLINE, Qt::Key_Return, Qt::Key_Return | Qt::SHIFT, QT_TRANSLATE_NOOP("QsciCommand", "Insert new line") }, { QsciScintillaBase::SCI_ZOOMIN, Qt::Key_Plus | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Zoom in") }, { QsciScintillaBase::SCI_ZOOMOUT, Qt::Key_Minus | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Zoom out") }, { QsciScintillaBase::SCI_SETZOOM, 0, 0, QT_TRANSLATE_NOOP("QsciCommand", "Set zoom") }, { QsciScintillaBase::SCI_FORMFEED, 0, 0, QT_TRANSLATE_NOOP("QsciCommand", "Formfeed") }, { QsciScintillaBase::SCI_LINECUT, Qt::Key_L | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Cut current line") }, { QsciScintillaBase::SCI_LINEDELETE, Qt::Key_L | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Delete current line") }, { QsciScintillaBase::SCI_LINECOPY, Qt::Key_T | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Copy current line") }, { QsciScintillaBase::SCI_LINETRANSPOSE, Qt::Key_T | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Swap current and previous lines") }, { QsciScintillaBase::SCI_SELECTIONDUPLICATE, Qt::Key_D | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Duplicate selection") }, { QsciScintillaBase::SCI_LOWERCASE, Qt::Key_U | Qt::CTRL, 0, QT_TRANSLATE_NOOP("QsciCommand", "Convert selection to lower case") }, { QsciScintillaBase::SCI_UPPERCASE, Qt::Key_U | Qt::CTRL | Qt::SHIFT, 0, QT_TRANSLATE_NOOP("QsciCommand", "Convert selection to upper case") }, { QsciScintillaBase::SCI_DELETEBACKNOTLINE, 0, 0, QT_TRANSLATE_NOOP("QsciCommand", "Delete previous character if not at line start") }, }; // Clear the default map. qsci->SendScintilla(QsciScintillaBase::SCI_CLEARALLCMDKEYS); for (int i = 0; i < sizeof (cmd_table) / sizeof (cmd_table[0]); ++i) cmds.append(new QsciCommand(qsci, cmd_table[i].msg, cmd_table[i].key, cmd_table[i].altkey, cmd_table[i].desc)); } // The dtor. QsciCommandSet::~QsciCommandSet() { for (int i = 0; i < cmds.count(); ++i) delete cmds.at(i); } // Read the command set from settings. bool QsciCommandSet::readSettings(QSettings &qs, const char *prefix) { bool rc = true; QString skey; for (int i = 0; i < cmds.count(); ++i) { QsciCommand *cmd = cmds.at(i); skey.sprintf("%s/keymap/c%d/", prefix, cmd->msgId()); int key; bool ok; // Read the key. ok = qs.contains(skey + "key"); key = qs.value(skey + "key", 0).toInt(); if (ok) cmd->setKey(key); else rc = false; // Read the alternate key. ok = qs.contains(skey + "alt"); key = qs.value(skey + "alt", 0).toInt(); if (ok) cmd->setAlternateKey(key); else rc = false; } return rc; } // Write the command set to settings. bool QsciCommandSet::writeSettings(QSettings &qs, const char *prefix) { bool rc = true; QString skey; for (int i = 0; i < cmds.count(); ++i) { QsciCommand *cmd = cmds.at(i); skey.sprintf("%s/keymap/c%d/", prefix, cmd->msgId()); // Write the key. qs.setValue(skey + "key", cmd->key()); // Write the alternate key. qs.setValue(skey + "alt", cmd->key()); } return rc; } // Clear the key bindings. void QsciCommandSet::clearKeys() { for (int i = 0; i < cmds.count(); ++i) cmds.at(i)->setKey(0); } // Clear the alternate key bindings. void QsciCommandSet::clearAlternateKeys() { for (int i = 0; i < cmds.count(); ++i) cmds.at(i)->setAlternateKey(0); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/ListBoxQt.cpp0000644000175000001440000001275711407213302022415 0ustar subzerousers// This module implements the specialisation of QListBox that handles the // Scintilla double-click callback. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "ListBoxQt.h" #include #include "SciClasses.h" // The backdoor through which the full text of the selected item is passed. QString ListBoxQt::backdoor; ListBoxQt::ListBoxQt() : cb_action(0), cb_data(0), slb(0), visible_rows(5), utf8(false) { } void ListBoxQt::SetFont(Font &font) { QFont *f = reinterpret_cast(font.GetID()); if (f) slb->setFont(*f); } void ListBoxQt::Create(Window &parent, int, Point, int, bool unicodeMode) { utf8 = unicodeMode; // The parent we want is the QsciScintillaBase, not the text area. id = slb = new SciListBox(reinterpret_cast(parent.GetID())->parentWidget(), this); } void ListBoxQt::SetAverageCharWidth(int) { // We rely on sizeHint() for the size of the list box rather than make // calculations based on the average character width and the number of // visible rows. } void ListBoxQt::SetVisibleRows(int vrows) { // We only pretend to implement this. visible_rows = vrows; } int ListBoxQt::GetVisibleRows() const { return visible_rows; } PRectangle ListBoxQt::GetDesiredRect() { PRectangle rc(0, 0, 100, 100); if (slb) { QSize sh = slb->sizeHint(); rc.right = sh.width(); rc.bottom = sh.height(); } return rc; } int ListBoxQt::CaretFromEdge() { int dist = 0; // Find the width of the biggest image. for (xpmMap::const_iterator it = xset.begin(); it != xset.end(); ++it) { int w = it.value().width(); if (dist < w) dist = w; } if (slb) dist += slb->frameWidth(); // Fudge factor - adjust if required. dist += 3; return dist; } void ListBoxQt::Clear() { Q_ASSERT(slb); slb->clear(); } void ListBoxQt::Append(char *s, int type) { Q_ASSERT(slb); QString qs; if (utf8) qs = QString::fromUtf8(s); else qs = QString::fromLatin1(s); xpmMap::const_iterator it; if (type < 0 || (it = xset.find(type)) == xset.end()) slb->addItem(qs); else slb->addItemPixmap(it.value(), qs); } int ListBoxQt::Length() { Q_ASSERT(slb); return slb->count(); } void ListBoxQt::Select(int n) { Q_ASSERT(slb); slb->setCurrentRow(n); } int ListBoxQt::GetSelection() { Q_ASSERT(slb); return slb->currentRow(); } int ListBoxQt::Find(const char *prefix) { Q_ASSERT(slb); return slb->find(prefix); } void ListBoxQt::GetValue(int n, char *value, int len) { Q_ASSERT(slb); backdoor = slb->text(n); if (backdoor.isEmpty() || len <= 0) value[0] = '\0'; else { const char *s; int slen; QByteArray bytes; if (utf8) bytes = backdoor.toUtf8(); else bytes = backdoor.toLatin1(); s = bytes.data(); slen = bytes.length(); // Copy everything up to the first space. We assume everything // afterwards is additional descriptive information which shouldn't // be inserted into the text. while (slen-- && len-- && *s != ' ') *value++ = *s++; *value = '\0'; } } void ListBoxQt::Sort() { Q_ASSERT(slb); slb->sortItems(); } void ListBoxQt::RegisterImage(int type,const char *xpm_data) { xset.insert(type, *reinterpret_cast(xpm_data)); } void ListBoxQt::ClearRegisteredImages() { xset.clear(); } void ListBoxQt::SetDoubleClickAction(CallBackAction action, void *data) { cb_action = action; cb_data = data; } void ListBoxQt::SetList(const char *list, char separator, char typesep) { char *words; Clear(); if ((words = qstrdup(list)) != NULL) { char *startword = words; char *numword = NULL; for (int i = 0; words[i] != '\0'; i++) { if (words[i] == separator) { words[i] = '\0'; if (numword) *numword = '\0'; Append(startword, numword ? atoi(numword + 1) : -1); startword = words + i + 1; numword = NULL; } else if (words[i] == typesep) { numword = words + i; } } if (startword) { if (numword) *numword = '\0'; Append(startword, numword ? atoi(numword + 1) : -1); } delete[] words; } } // The ListBox methods that need to be implemented explicitly. ListBox::ListBox() { } ListBox::~ListBox() { } ListBox *ListBox::Allocate() { return new ListBoxQt(); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/ListBoxQt.h0000644000175000001440000000417411407213302022054 0ustar subzerousers// This defines the specialisation of QListBox that handles the Scintilla // double-click callback. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include #include "Platform.h" class SciListBox; class ListBoxQt : public ListBox { public: ListBoxQt(); CallBackAction cb_action; void *cb_data; virtual void SetFont(Font &font); virtual void Create(Window &parent, int, Point, int, bool unicodeMode); virtual void SetAverageCharWidth(int); virtual void SetVisibleRows(int); virtual int GetVisibleRows() const; virtual PRectangle GetDesiredRect(); virtual int CaretFromEdge(); virtual void Clear(); virtual void Append(char *s, int type = -1); virtual int Length(); virtual void Select(int n); virtual int GetSelection(); virtual int Find(const char *prefix); virtual void GetValue(int n, char *value, int len); virtual void Sort(); virtual void RegisterImage(int type, const char *xpm_data); virtual void ClearRegisteredImages(); virtual void SetDoubleClickAction(CallBackAction action, void *data); virtual void SetList(const char *list, char separator, char typesep); static QString backdoor; private: SciListBox *slb; int visible_rows; bool utf8; typedef QMap xpmMap; xpmMap xset; }; sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscidocument.cpp0000644000175000001440000000633511407213302023215 0ustar subzerousers// This module implements the QsciDocument class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscidocument.h" #include "Qsci/qsciscintillabase.h" // This internal class encapsulates the underlying document and is shared by // QsciDocument instances. class QsciDocumentP { public: QsciDocumentP() : doc(0), nr_displays(0), nr_attaches(1) {} long doc; // The Scintilla document. int nr_displays; // The number of displays. int nr_attaches; // The number of attaches. }; // The ctor. QsciDocument::QsciDocument() { pdoc = new QsciDocumentP(); } // The dtor. QsciDocument::~QsciDocument() { detach(); } // The copy ctor. QsciDocument::QsciDocument(const QsciDocument &that) { attach(that); } // The assignment operator. QsciDocument &QsciDocument::operator=(const QsciDocument &that) { if (pdoc != that.pdoc) { detach(); attach(that); } return *this; } // Attach an existing document to this one. void QsciDocument::attach(const QsciDocument &that) { ++that.pdoc->nr_attaches; pdoc = that.pdoc; } // Detach the underlying document. void QsciDocument::detach() { if (!pdoc) return; if (--pdoc->nr_attaches == 0) { if (pdoc->doc && pdoc->nr_displays == 0) { QsciScintillaBase *qsb = QsciScintillaBase::pool(); // Release the explicit reference to the document. If the pool is // empty then we just accept the memory leak. if (qsb) qsb->SendScintilla(QsciScintillaBase::SCI_RELEASEDOCUMENT, 0, pdoc->doc); } delete pdoc; } pdoc = 0; } // Undisplay and detach the underlying document. void QsciDocument::undisplay(QsciScintillaBase *qsb) { if (--pdoc->nr_attaches == 0) delete pdoc; else if (--pdoc->nr_displays == 0) { // Create an explicit reference to the document to keep it alive. qsb->SendScintilla(QsciScintillaBase::SCI_ADDREFDOCUMENT, 0, pdoc->doc); } pdoc = 0; } // Display the underlying document. void QsciDocument::display(QsciScintillaBase *qsb, const QsciDocument *from) { long ndoc; if (from) { ndoc = from->pdoc->doc; qsb->SendScintilla(QsciScintillaBase::SCI_SETDOCPOINTER, 0, ndoc); } else ndoc = qsb->SendScintilla(QsciScintillaBase::SCI_GETDOCPOINTER); pdoc->doc = ndoc; ++pdoc->nr_displays; } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerpov.cpp0000644000175000001440000003076111407213302023243 0ustar subzerousers// This module implements the QsciLexerPOV class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerpov.h" #include #include #include // The ctor. QsciLexerPOV::QsciLexerPOV(QObject *parent) : QsciLexer(parent), fold_comments(false), fold_compact(true), fold_directives(false) { } // The dtor. QsciLexerPOV::~QsciLexerPOV() { } // Returns the language name. const char *QsciLexerPOV::language() const { return "POV"; } // Returns the lexer name. const char *QsciLexerPOV::lexer() const { return "pov"; } // Return the style used for braces. int QsciLexerPOV::braceStyle() const { return Operator; } // Return the string of characters that comprise a word. const char *QsciLexerPOV::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#"; } // Returns the foreground colour of the text for a style. QColor QsciLexerPOV::defaultColor(int style) const { switch (style) { case Default: return QColor(0xff,0x00,0x80); case Comment: case CommentLine: return QColor(0x00,0x7f,0x00); case Number: return QColor(0x00,0x7f,0x7f); case Operator: return QColor(0x00,0x00,0x00); case String: return QColor(0x7f,0x00,0x7f); case Directive: return QColor(0x7f,0x7f,0x00); case BadDirective: return QColor(0x80,0x40,0x20); case ObjectsCSGAppearance: case TypesModifiersItems: case PredefinedIdentifiers: case PredefinedFunctions: case KeywordSet6: case KeywordSet7: case KeywordSet8: return QColor(0x00,0x00,0x7f); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerPOV::defaultEolFill(int style) const { if (style == UnclosedString) return true; return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerPOV::defaultFont(int style) const { QFont f; switch (style) { case Comment: case CommentLine: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case UnclosedString: case PredefinedIdentifiers: f = QsciLexer::defaultFont(style); f.setBold(true); break; case BadDirective: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif f.setItalic(true); break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerPOV::keywords(int set) const { if (set == 1) return "declare local include undef fopen fclose read write " "default version case range break debug error " "warning if ifdef ifndef switch while macro else end"; if (set == 2) return "camera light_source light_group object blob sphere " "cylinder box cone height_field julia_fractal lathe " "prism sphere_sweep superellipsoid sor text torus " "bicubic_patch disc mesh mesh2 polygon triangle " "smooth_triangle plane poly cubic quartic quadric " "isosurface parametric union intersection difference " "merge function array spline vertex_vectors " "normal_vectors uv_vectors face_indices " "normal_indices uv_indices texture texture_list " "interior_texture texture_map material_map image_map " "color_map colour_map pigment_map normal_map " "slope_map bump_map density_map pigment normal " "material interior finish reflection irid slope " "pigment_pattern image_pattern warp media scattering " "density background fog sky_sphere rainbow " "global_settings radiosity photons pattern transform " "looks_like projected_through contained_by " "clipped_by bounded_by"; if (set == 3) return "linear_spline quadratic_spline cubic_spline " "natural_spline bezier_spline b_spline read write " "append inverse open perspective orthographic " "fisheye ultra_wide_angle omnimax panoramic " "spherical spotlight jitter circular orient " "media_attenuation media_interaction shadowless " "parallel refraction collect pass_through " "global_lights hierarchy sturm smooth gif tga iff " "pot png pgm ppm jpeg tiff sys ttf quaternion " "hypercomplex linear_sweep conic_sweep type " "all_intersections split_union cutaway_textures " "no_shadow no_image no_reflection double_illuminate " "hollow uv_mapping all use_index use_color " "use_colour no_bump_scale conserve_energy fresnel " "average agate boxed bozo bumps cells crackle " "cylindrical density_file dents facets granite " "leopard marble onion planar quilted radial ripples " "spotted waves wood wrinkles solid use_alpha " "interpolate magnet noise_generator toroidal " "ramp_wave triangle_wave sine_wave scallop_wave " "cubic_wave poly_wave once map_type method fog_type " "hf_gray_16 charset ascii utf8 rotate scale " "translate matrix location right up direction sky " "angle look_at aperture blur_samples focal_point " "confidence variance radius falloff tightness " "point_at area_light adaptive fade_distance " "fade_power threshold strength water_level tolerance " "max_iteration precision slice u_steps v_steps " "flatness inside_vector accuracy max_gradient " "evaluate max_trace precompute target ior dispersion " "dispersion_samples caustics color colour rgb rgbf " "rgbt rgbft red green blue filter transmit gray hf " "fade_color fade_colour quick_color quick_colour " "brick checker hexagon brick_size mortar bump_size " "ambient diffuse brilliance crand phong phong_size " "metallic specular roughness reflection_exponent " "exponent thickness gradient spiral1 spiral2 " "agate_turb form metric offset df3 coords size " "mandel exterior julia control0 control1 altitude " "turbulence octaves omega lambda repeat flip " "black-hole orientation dist_exp major_radius " "frequency phase intervals samples ratio absorption " "emission aa_threshold aa_level eccentricity " "extinction distance turb_depth fog_offset fog_alt " "width arc_angle falloff_angle adc_bailout " "ambient_light assumed_gamma irid_wavelength " "number_of_waves always_sample brigthness count " "error_bound gray_threshold load_file " "low_error_factor max_sample minimum_reuse " "nearest_count pretrace_end pretrace_start " "recursion_limit save_file spacing gather " "max_trace_level autostop expand_thresholds"; if (set == 4) return "x y z t u v yes no true false on off clock " "clock_delta clock_on final_clock final_frame " "frame_number image_height image_width initial_clock " "initial_frame pi version"; if (set == 5) return "abs acos acosh asc asin asinh atan atanh atan2 ceil " "cos cosh defined degrees dimensions dimension_size " "div exp file_exists floor inside int ln log max min " "mod pow prod radians rand seed select sin sinh sqrt " "strcmp strlen sum tan tanh val vdot vlength " "min_extent max_extent trace vaxis_rotate vcross " "vrotate vnormalize vturbulence chr concat str " "strlwr strupr substr vstr sqr cube reciprocal pwr"; return 0; } // Returns the user name of a style. QString QsciLexerPOV::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case CommentLine: return tr("Comment line"); case Number: return tr("Number"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case String: return tr("String"); case UnclosedString: return tr("Unclosed string"); case Directive: return tr("Directive"); case BadDirective: return tr("Bad directive"); case ObjectsCSGAppearance: return tr("Objects, CSG and appearance"); case TypesModifiersItems: return tr("Types, modifiers and items"); case PredefinedIdentifiers: return tr("Predefined identifiers"); case PredefinedFunctions: return tr("Predefined functions"); case KeywordSet6: return tr("User defined 1"); case KeywordSet7: return tr("User defined 2"); case KeywordSet8: return tr("User defined 3"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerPOV::defaultPaper(int style) const { switch (style) { case UnclosedString: return QColor(0xe0,0xc0,0xe0); case ObjectsCSGAppearance: return QColor(0xff,0xd0,0xd0); case TypesModifiersItems: return QColor(0xff,0xff,0xd0); case PredefinedFunctions: return QColor(0xd0,0xd0,0xff); case KeywordSet6: return QColor(0xd0,0xff,0xd0); case KeywordSet7: return QColor(0xd0,0xd0,0xd0); case KeywordSet8: return QColor(0xe0,0xe0,0xe0); } return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerPOV::refreshProperties() { setCommentProp(); setCompactProp(); setDirectiveProp(); } // Read properties from the settings. bool QsciLexerPOV::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_comments = qs.value(prefix + "foldcomments", false).toBool(); fold_compact = qs.value(prefix + "foldcompact", true).toBool(); fold_directives = qs.value(prefix + "folddirectives", false).toBool(); return rc; } // Write properties to the settings. bool QsciLexerPOV::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldcomments", fold_comments); qs.setValue(prefix + "foldcompact", fold_compact); qs.setValue(prefix + "folddirectives", fold_directives); return rc; } // Return true if comments can be folded. bool QsciLexerPOV::foldComments() const { return fold_comments; } // Set if comments can be folded. void QsciLexerPOV::setFoldComments(bool fold) { fold_comments = fold; setCommentProp(); } // Set the "fold.comment" property. void QsciLexerPOV::setCommentProp() { emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); } // Return true if folds are compact. bool QsciLexerPOV::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerPOV::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerPOV::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } // Return true if directives can be folded. bool QsciLexerPOV::foldDirectives() const { return fold_directives; } // Set if directives can be folded. void QsciLexerPOV::setFoldDirectives(bool fold) { fold_directives = fold; setDirectiveProp(); } // Set the "fold.directive" property. void QsciLexerPOV::setDirectiveProp() { emit propertyChanged("fold.directive",(fold_directives ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerhtml.cpp0000644000175000001440000006735011407213302023407 0ustar subzerousers// This module implements the QsciLexerHTML class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerhtml.h" #include #include #include #include "Qsci/qscilexerjavascript.h" #include "Qsci/qscilexerpython.h" // The ctor. QsciLexerHTML::QsciLexerHTML(QObject *parent) : QsciLexer(parent), fold_compact(true), fold_preproc(true), case_sens_tags(false) { } // The dtor. QsciLexerHTML::~QsciLexerHTML() { } // Returns the language name. const char *QsciLexerHTML::language() const { return "HTML"; } // Returns the lexer name. const char *QsciLexerHTML::lexer() const { return "hypertext"; } // Return the string of characters that comprise a word. const char *QsciLexerHTML::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"; } // Returns the foreground colour of the text for a style. QColor QsciLexerHTML::defaultColor(int style) const { switch (style) { case Default: case JavaScriptDefault: case JavaScriptWord: case JavaScriptSymbol: case ASPJavaScriptDefault: case ASPJavaScriptWord: case ASPJavaScriptSymbol: case VBScriptDefault: case ASPVBScriptDefault: case PHPOperator: return QColor(0x00,0x00,0x00); case Tag: case XMLTagEnd: case Script: case SGMLDefault: case SGMLCommand: case VBScriptKeyword: case VBScriptIdentifier: case VBScriptUnclosedString: case ASPVBScriptKeyword: case ASPVBScriptIdentifier: case ASPVBScriptUnclosedString: return QColor(0x00,0x00,0x80); case UnknownTag: case UnknownAttribute: return QColor(0xff,0x00,0x00); case Attribute: case VBScriptNumber: case ASPVBScriptNumber: return QColor(0x00,0x80,0x80); case HTMLNumber: case JavaScriptNumber: case ASPJavaScriptNumber: case PythonNumber: case PythonFunctionMethodName: case ASPPythonNumber: case ASPPythonFunctionMethodName: return QColor(0x00,0x7f,0x7f); case HTMLDoubleQuotedString: case HTMLSingleQuotedString: case JavaScriptDoubleQuotedString: case JavaScriptSingleQuotedString: case ASPJavaScriptDoubleQuotedString: case ASPJavaScriptSingleQuotedString: case PythonDoubleQuotedString: case PythonSingleQuotedString: case ASPPythonDoubleQuotedString: case ASPPythonSingleQuotedString: case PHPKeyword: return QColor(0x7f,0x00,0x7f); case OtherInTag: case Entity: case VBScriptString: case ASPVBScriptString: return QColor(0x80,0x00,0x80); case HTMLComment: case SGMLComment: return QColor(0x80,0x80,0x00); case XMLStart: case XMLEnd: case PHPStart: case PythonClassName: case ASPPythonClassName: return QColor(0x00,0x00,0xff); case HTMLValue: return QColor(0xff,0x00,0xff); case SGMLParameter: return QColor(0x00,0x66,0x00); case SGMLDoubleQuotedString: case SGMLError: return QColor(0x80,0x00,0x00); case SGMLSingleQuotedString: return QColor(0x99,0x33,0x00); case SGMLSpecial: return QColor(0x33,0x66,0xff); case SGMLEntity: return QColor(0x33,0x33,0x33); case SGMLBlockDefault: return QColor(0x00,0x00,0x66); case JavaScriptStart: case ASPJavaScriptStart: return QColor(0x7f,0x7f,0x00); case JavaScriptComment: case JavaScriptCommentLine: case ASPJavaScriptComment: case ASPJavaScriptCommentLine: case PythonComment: case ASPPythonComment: case PHPDoubleQuotedString: return QColor(0x00,0x7f,0x00); case JavaScriptCommentDoc: return QColor(0x3f,0x70,0x3f); case JavaScriptKeyword: case ASPJavaScriptKeyword: case PythonKeyword: case ASPPythonKeyword: case PHPVariable: case PHPDoubleQuotedVariable: return QColor(0x00,0x00,0x7f); case ASPJavaScriptCommentDoc: return QColor(0x7f,0x7f,0x7f); case VBScriptComment: case ASPVBScriptComment: return QColor(0x00,0x80,0x00); case PythonStart: case PythonDefault: case ASPPythonStart: case ASPPythonDefault: return QColor(0x80,0x80,0x80); case PythonTripleSingleQuotedString: case PythonTripleDoubleQuotedString: case ASPPythonTripleSingleQuotedString: case ASPPythonTripleDoubleQuotedString: return QColor(0x7f,0x00,0x00); case PHPDefault: return QColor(0x00,0x00,0x33); case PHPSingleQuotedString: return QColor(0x00,0x9f,0x00); case PHPNumber: return QColor(0xcc,0x99,0x00); case PHPComment: return QColor(0x99,0x99,0x99); case PHPCommentLine: return QColor(0x66,0x66,0x66); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerHTML::defaultEolFill(int style) const { switch (style) { case JavaScriptDefault: case JavaScriptComment: case JavaScriptCommentDoc: case JavaScriptUnclosedString: case ASPJavaScriptDefault: case ASPJavaScriptComment: case ASPJavaScriptCommentDoc: case ASPJavaScriptUnclosedString: case VBScriptDefault: case VBScriptComment: case VBScriptNumber: case VBScriptKeyword: case VBScriptString: case VBScriptIdentifier: case VBScriptUnclosedString: case ASPVBScriptDefault: case ASPVBScriptComment: case ASPVBScriptNumber: case ASPVBScriptKeyword: case ASPVBScriptString: case ASPVBScriptIdentifier: case ASPVBScriptUnclosedString: case PythonDefault: case PythonComment: case PythonNumber: case PythonDoubleQuotedString: case PythonSingleQuotedString: case PythonKeyword: case PythonTripleSingleQuotedString: case PythonTripleDoubleQuotedString: case PythonClassName: case PythonFunctionMethodName: case PythonOperator: case PythonIdentifier: case ASPPythonDefault: case ASPPythonComment: case ASPPythonNumber: case ASPPythonDoubleQuotedString: case ASPPythonSingleQuotedString: case ASPPythonKeyword: case ASPPythonTripleSingleQuotedString: case ASPPythonTripleDoubleQuotedString: case ASPPythonClassName: case ASPPythonFunctionMethodName: case ASPPythonOperator: case ASPPythonIdentifier: case PHPDefault: return true; } return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerHTML::defaultFont(int style) const { QFont f; switch (style) { case Default: case Entity: #if defined(Q_OS_WIN) f = QFont("Times New Roman",11); #else f = QFont("Bitstream Charter",10); #endif break; case HTMLComment: #if defined(Q_OS_WIN) f = QFont("Verdana",9); #else f = QFont("Bitstream Vera Sans",8); #endif break; case SGMLCommand: case PythonKeyword: case PythonClassName: case PythonFunctionMethodName: case PythonOperator: case ASPPythonKeyword: case ASPPythonClassName: case ASPPythonFunctionMethodName: case ASPPythonOperator: f = QsciLexer::defaultFont(style); f.setBold(true); break; case JavaScriptDefault: case JavaScriptCommentDoc: case JavaScriptKeyword: case JavaScriptSymbol: case ASPJavaScriptDefault: case ASPJavaScriptCommentDoc: case ASPJavaScriptKeyword: case ASPJavaScriptSymbol: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif f.setBold(true); break; case JavaScriptComment: case JavaScriptCommentLine: case JavaScriptNumber: case JavaScriptWord: case JavaScriptDoubleQuotedString: case JavaScriptSingleQuotedString: case ASPJavaScriptComment: case ASPJavaScriptCommentLine: case ASPJavaScriptNumber: case ASPJavaScriptWord: case ASPJavaScriptDoubleQuotedString: case ASPJavaScriptSingleQuotedString: case VBScriptComment: case ASPVBScriptComment: case PythonComment: case ASPPythonComment: case PHPComment: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case VBScriptDefault: case VBScriptNumber: case VBScriptString: case VBScriptIdentifier: case VBScriptUnclosedString: case ASPVBScriptDefault: case ASPVBScriptNumber: case ASPVBScriptString: case ASPVBScriptIdentifier: case ASPVBScriptUnclosedString: #if defined(Q_OS_WIN) f = QFont("Lucida Sans Unicode",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case VBScriptKeyword: case ASPVBScriptKeyword: #if defined(Q_OS_WIN) f = QFont("Lucida Sans Unicode",9); #else f = QFont("Bitstream Vera Serif",9); #endif f.setBold(true); break; case PythonDoubleQuotedString: case PythonSingleQuotedString: case ASPPythonDoubleQuotedString: case ASPPythonSingleQuotedString: #if defined(Q_OS_WIN) f = QFont("Courier New",10); #else f = QFont("Bitstream Vera Sans Mono",9); #endif break; case PHPKeyword: case PHPVariable: case PHPDoubleQuotedVariable: f = QsciLexer::defaultFont(style); f.setItalic(true); break; case PHPCommentLine: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif f.setItalic(true); break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerHTML::keywords(int set) const { if (set == 1) return "a abbr acronym address applet area " "b base basefont bdo big blockquote body br button " "caption center cite code col colgroup " "dd del dfn dir div dl dt " "em " "fieldset font form frame frameset " "h1 h2 h3 h4 h5 h6 head hr html " "i iframe img input ins isindex " "kbd " "label legend li link " "map menu meta " "noframes noscript " "object ol optgroup option " "p param pre " "q " "s samp script select small span strike strong style " "sub sup " "table tbody td textarea tfoot th thead title tr tt " "u ul " "var " "xml xmlns " "abbr accept-charset accept accesskey action align " "alink alt archive axis " "background bgcolor border " "cellpadding cellspacing char charoff charset checked " "cite class classid clear codebase codetype color " "cols colspan compact content coords " "data datafld dataformatas datapagesize datasrc " "datetime declare defer dir disabled " "enctype event " "face for frame frameborder " "headers height href hreflang hspace http-equiv " "id ismap label lang language leftmargin link " "longdesc " "marginwidth marginheight maxlength media method " "multiple " "name nohref noresize noshade nowrap " "object onblur onchange onclick ondblclick onfocus " "onkeydown onkeypress onkeyup onload onmousedown " "onmousemove onmouseover onmouseout onmouseup onreset " "onselect onsubmit onunload " "profile prompt " "readonly rel rev rows rowspan rules " "scheme scope selected shape size span src standby " "start style summary " "tabindex target text title topmargin type " "usemap " "valign value valuetype version vlink vspace " "width " "text password checkbox radio submit reset file " "hidden image " "public !doctype"; if (set == 2) return QsciLexerJavaScript::keywordClass; if (set == 3) return // Move these to QsciLexerVisualBasic when we // get round to implementing it. "and begin case call continue do each else elseif end " "erase error event exit false for function get gosub " "goto if implement in load loop lset me mid new next " "not nothing on or property raiseevent rem resume " "return rset select set stop sub then to true unload " "until wend while with withevents attribute alias as " "boolean byref byte byval const compare currency date " "declare dim double enum explicit friend global " "integer let lib long module object option optional " "preserve private property public redim single static " "string type variant"; if (set == 4) return QsciLexerPython::keywordClass; if (set == 5) return "and argv as argc break case cfunction class continue " "declare default do die " "echo else elseif empty enddeclare endfor endforeach " "endif endswitch endwhile e_all e_parse e_error " "e_warning eval exit extends " "false for foreach function global " "http_cookie_vars http_get_vars http_post_vars " "http_post_files http_env_vars http_server_vars " "if include include_once list new not null " "old_function or " "parent php_os php_self php_version print " "require require_once return " "static switch stdclass this true var xor virtual " "while " "__file__ __line__ __sleep __wakeup"; if (set == 6) return "ELEMENT DOCTYPE ATTLIST ENTITY NOTATION"; return 0; } // Returns the user name of a style. QString QsciLexerHTML::description(int style) const { switch (style) { case Default: return tr("HTML default"); case Tag: return tr("Tag"); case UnknownTag: return tr("Unknown tag"); case Attribute: return tr("Attribute"); case UnknownAttribute: return tr("Unknown attribute"); case HTMLNumber: return tr("HTML number"); case HTMLDoubleQuotedString: return tr("HTML double-quoted string"); case HTMLSingleQuotedString: return tr("HTML single-quoted string"); case OtherInTag: return tr("Other text in a tag"); case HTMLComment: return tr("HTML comment"); case Entity: return tr("Entity"); case XMLTagEnd: return tr("End of a tag"); case XMLStart: return tr("Start of an XML fragment"); case XMLEnd: return tr("End of an XML fragment"); case Script: return tr("Script tag"); case ASPAtStart: return tr("Start of an ASP fragment with @"); case ASPStart: return tr("Start of an ASP fragment"); case CDATA: return tr("CDATA"); case PHPStart: return tr("Start of a PHP fragment"); case HTMLValue: return tr("Unquoted HTML value"); case ASPXCComment: return tr("ASP X-Code comment"); case SGMLDefault: return tr("SGML default"); case SGMLCommand: return tr("SGML command"); case SGMLParameter: return tr("First parameter of an SGML command"); case SGMLDoubleQuotedString: return tr("SGML double-quoted string"); case SGMLSingleQuotedString: return tr("SGML single-quoted string"); case SGMLError: return tr("SGML error"); case SGMLSpecial: return tr("SGML special entity"); case SGMLComment: return tr("SGML comment"); case SGMLParameterComment: return tr("First parameter comment of an SGML command"); case SGMLBlockDefault: return tr("SGML block default"); case JavaScriptStart: return tr("Start of a JavaScript fragment"); case JavaScriptDefault: return tr("JavaScript default"); case JavaScriptComment: return tr("JavaScript comment"); case JavaScriptCommentLine: return tr("JavaScript line comment"); case JavaScriptCommentDoc: return tr("JavaDoc style JavaScript comment"); case JavaScriptNumber: return tr("JavaScript number"); case JavaScriptWord: return tr("JavaScript word"); case JavaScriptKeyword: return tr("JavaScript keyword"); case JavaScriptDoubleQuotedString: return tr("JavaScript double-quoted string"); case JavaScriptSingleQuotedString: return tr("JavaScript single-quoted string"); case JavaScriptSymbol: return tr("JavaScript symbol"); case JavaScriptUnclosedString: return tr("JavaScript unclosed string"); case JavaScriptRegex: return tr("JavaScript regular expression"); case ASPJavaScriptStart: return tr("Start of an ASP JavaScript fragment"); case ASPJavaScriptDefault: return tr("ASP JavaScript default"); case ASPJavaScriptComment: return tr("ASP JavaScript comment"); case ASPJavaScriptCommentLine: return tr("ASP JavaScript line comment"); case ASPJavaScriptCommentDoc: return tr("JavaDoc style ASP JavaScript comment"); case ASPJavaScriptNumber: return tr("ASP JavaScript number"); case ASPJavaScriptWord: return tr("ASP JavaScript word"); case ASPJavaScriptKeyword: return tr("ASP JavaScript keyword"); case ASPJavaScriptDoubleQuotedString: return tr("ASP JavaScript double-quoted string"); case ASPJavaScriptSingleQuotedString: return tr("ASP JavaScript single-quoted string"); case ASPJavaScriptSymbol: return tr("ASP JavaScript symbol"); case ASPJavaScriptUnclosedString: return tr("ASP JavaScript unclosed string"); case ASPJavaScriptRegex: return tr("ASP JavaScript regular expression"); case VBScriptStart: return tr("Start of a VBScript fragment"); case VBScriptDefault: return tr("VBScript default"); case VBScriptComment: return tr("VBScript comment"); case VBScriptNumber: return tr("VBScript number"); case VBScriptKeyword: return tr("VBScript keyword"); case VBScriptString: return tr("VBScript string"); case VBScriptIdentifier: return tr("VBScript identifier"); case VBScriptUnclosedString: return tr("VBScript unclosed string"); case ASPVBScriptStart: return tr("Start of an ASP VBScript fragment"); case ASPVBScriptDefault: return tr("ASP VBScript default"); case ASPVBScriptComment: return tr("ASP VBScript comment"); case ASPVBScriptNumber: return tr("ASP VBScript number"); case ASPVBScriptKeyword: return tr("ASP VBScript keyword"); case ASPVBScriptString: return tr("ASP VBScript string"); case ASPVBScriptIdentifier: return tr("ASP VBScript identifier"); case ASPVBScriptUnclosedString: return tr("ASP VBScript unclosed string"); case PythonStart: return tr("Start of a Python fragment"); case PythonDefault: return tr("Python default"); case PythonComment: return tr("Python comment"); case PythonNumber: return tr("Python number"); case PythonDoubleQuotedString: return tr("Python double-quoted string"); case PythonSingleQuotedString: return tr("Python single-quoted string"); case PythonKeyword: return tr("Python keyword"); case PythonTripleDoubleQuotedString: return tr("Python triple double-quoted string"); case PythonTripleSingleQuotedString: return tr("Python triple single-quoted string"); case PythonClassName: return tr("Python class name"); case PythonFunctionMethodName: return tr("Python function or method name"); case PythonOperator: return tr("Python operator"); case PythonIdentifier: return tr("Python identifier"); case ASPPythonStart: return tr("Start of an ASP Python fragment"); case ASPPythonDefault: return tr("ASP Python default"); case ASPPythonComment: return tr("ASP Python comment"); case ASPPythonNumber: return tr("ASP Python number"); case ASPPythonDoubleQuotedString: return tr("ASP Python double-quoted string"); case ASPPythonSingleQuotedString: return tr("ASP Python single-quoted string"); case ASPPythonKeyword: return tr("ASP Python keyword"); case ASPPythonTripleDoubleQuotedString: return tr("ASP Python triple double-quoted string"); case ASPPythonTripleSingleQuotedString: return tr("ASP Python triple single-quoted string"); case ASPPythonClassName: return tr("ASP Python class name"); case ASPPythonFunctionMethodName: return tr("ASP Python function or method name"); case ASPPythonOperator: return tr("ASP Python operator"); case ASPPythonIdentifier: return tr("ASP Python identifier"); case PHPDefault: return tr("PHP default"); case PHPDoubleQuotedString: return tr("PHP double-quoted string"); case PHPSingleQuotedString: return tr("PHP single-quoted string"); case PHPKeyword: return tr("PHP keyword"); case PHPNumber: return tr("PHP number"); case PHPVariable: return tr("PHP variable"); case PHPComment: return tr("PHP comment"); case PHPCommentLine: return tr("PHP line comment"); case PHPDoubleQuotedVariable: return tr("PHP double-quoted variable"); case PHPOperator: return tr("PHP operator"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerHTML::defaultPaper(int style) const { switch (style) { case ASPAtStart: return QColor(0xff,0xff,0x00); case ASPStart: case CDATA: return QColor(0xff,0xdf,0x00); case PHPStart: return QColor(0xff,0xef,0xbf); case HTMLValue: return QColor(0xff,0xef,0xff); case SGMLDefault: case SGMLCommand: case SGMLParameter: case SGMLDoubleQuotedString: case SGMLSingleQuotedString: case SGMLSpecial: case SGMLEntity: case SGMLComment: return QColor(0xef,0xef,0xff); case SGMLError: return QColor(0xff,0x66,0x66); case SGMLBlockDefault: return QColor(0xcc,0xcc,0xe0); case JavaScriptDefault: case JavaScriptComment: case JavaScriptCommentLine: case JavaScriptCommentDoc: case JavaScriptNumber: case JavaScriptWord: case JavaScriptKeyword: case JavaScriptDoubleQuotedString: case JavaScriptSingleQuotedString: case JavaScriptSymbol: return QColor(0xf0,0xf0,0xff); case JavaScriptUnclosedString: case ASPJavaScriptUnclosedString: return QColor(0xbf,0xbb,0xb0); case JavaScriptRegex: case ASPJavaScriptRegex: return QColor(0xff,0xbb,0xb0); case ASPJavaScriptDefault: case ASPJavaScriptComment: case ASPJavaScriptCommentLine: case ASPJavaScriptCommentDoc: case ASPJavaScriptNumber: case ASPJavaScriptWord: case ASPJavaScriptKeyword: case ASPJavaScriptDoubleQuotedString: case ASPJavaScriptSingleQuotedString: case ASPJavaScriptSymbol: return QColor(0xdf,0xdf,0x7f); case VBScriptDefault: case VBScriptComment: case VBScriptNumber: case VBScriptKeyword: case VBScriptString: case VBScriptIdentifier: return QColor(0xef,0xef,0xff); case VBScriptUnclosedString: case ASPVBScriptUnclosedString: return QColor(0x7f,0x7f,0xff); case ASPVBScriptDefault: case ASPVBScriptComment: case ASPVBScriptNumber: case ASPVBScriptKeyword: case ASPVBScriptString: case ASPVBScriptIdentifier: return QColor(0xcf,0xcf,0xef); case PythonDefault: case PythonComment: case PythonNumber: case PythonDoubleQuotedString: case PythonSingleQuotedString: case PythonKeyword: case PythonTripleSingleQuotedString: case PythonTripleDoubleQuotedString: case PythonClassName: case PythonFunctionMethodName: case PythonOperator: case PythonIdentifier: return QColor(0xef,0xff,0xef); case ASPPythonDefault: case ASPPythonComment: case ASPPythonNumber: case ASPPythonDoubleQuotedString: case ASPPythonSingleQuotedString: case ASPPythonKeyword: case ASPPythonTripleSingleQuotedString: case ASPPythonTripleDoubleQuotedString: case ASPPythonClassName: case ASPPythonFunctionMethodName: case ASPPythonOperator: case ASPPythonIdentifier: return QColor(0xcf,0xef,0xcf); case PHPDefault: case PHPDoubleQuotedString: case PHPSingleQuotedString: case PHPKeyword: case PHPNumber: case PHPVariable: case PHPComment: case PHPCommentLine: case PHPDoubleQuotedVariable: case PHPOperator: return QColor(0xff,0xf8,0xf8); } return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerHTML::refreshProperties() { setCompactProp(); setPreprocProp(); setCaseSensTagsProp(); } // Read properties from the settings. bool QsciLexerHTML::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_compact = qs.value(prefix + "foldcompact", true).toBool(); fold_preproc = qs.value(prefix + "foldpreprocessor", false).toBool(); case_sens_tags = qs.value(prefix + "casesensitivetags", false).toBool(); return rc; } // Write properties to the settings. bool QsciLexerHTML::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldcompact", fold_compact); qs.setValue(prefix + "foldpreprocessor", fold_preproc); qs.setValue(prefix + "casesensitivetags", case_sens_tags); return rc; } // Return true if tags are case sensitive. bool QsciLexerHTML::caseSensitiveTags() const { return case_sens_tags; } // Set if tags are case sensitive. void QsciLexerHTML::setCaseSensitiveTags(bool sens) { case_sens_tags = sens; setCaseSensTagsProp(); } // Set the "html.tags.case.sensitive" property. void QsciLexerHTML::setCaseSensTagsProp() { emit propertyChanged("html.tags.case.sensitive",(case_sens_tags ? "1" : "0")); } // Return true if folds are compact. bool QsciLexerHTML::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerHTML::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerHTML::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } // Return true if preprocessor blocks can be folded. bool QsciLexerHTML::foldPreprocessor() const { return fold_preproc; } // Set if preprocessor blocks can be folded. void QsciLexerHTML::setFoldPreprocessor(bool fold) { fold_preproc = fold; setPreprocProp(); } // Set the "fold.preprocessor" property. void QsciLexerHTML::setPreprocProp() { emit propertyChanged("fold.html.preprocessor",(fold_preproc ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexercpp.cpp0000644000175000001440000002535711407213302023226 0ustar subzerousers// This module implements the QsciLexerCPP class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexercpp.h" #include #include #include // The ctor. QsciLexerCPP::QsciLexerCPP(QObject *parent, bool caseInsensitiveKeywords) : QsciLexer(parent), fold_atelse(false), fold_comments(false), fold_compact(true), fold_preproc(true), style_preproc(false), nocase(caseInsensitiveKeywords) { } // The dtor. QsciLexerCPP::~QsciLexerCPP() { } // Returns the language name. const char *QsciLexerCPP::language() const { return "C++"; } // Returns the lexer name. const char *QsciLexerCPP::lexer() const { return (nocase ? "cppnocase" : "cpp"); } // Return the set of character sequences that can separate auto-completion // words. QStringList QsciLexerCPP::autoCompletionWordSeparators() const { QStringList wl; wl << "::" << "->" << "."; return wl; } // Return the list of keywords that can start a block. const char *QsciLexerCPP::blockStartKeyword(int *style) const { if (style) *style = Keyword; return "case catch class default do else finally for if private " "protected public struct try union while"; } // Return the list of characters that can start a block. const char *QsciLexerCPP::blockStart(int *style) const { if (style) *style = Operator; return "{"; } // Return the list of characters that can end a block. const char *QsciLexerCPP::blockEnd(int *style) const { if (style) *style = Operator; return "}"; } // Return the style used for braces. int QsciLexerCPP::braceStyle() const { return Operator; } // Return the string of characters that comprise a word. const char *QsciLexerCPP::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#"; } // Returns the foreground colour of the text for a style. QColor QsciLexerCPP::defaultColor(int style) const { switch (style) { case Default: return QColor(0x80,0x80,0x80); case Comment: case CommentLine: return QColor(0x00,0x7f,0x00); case CommentDoc: case CommentLineDoc: return QColor(0x3f,0x70,0x3f); case Number: return QColor(0x00,0x7f,0x7f); case Keyword: return QColor(0x00,0x00,0x7f); case DoubleQuotedString: case SingleQuotedString: return QColor(0x7f,0x00,0x7f); case PreProcessor: return QColor(0x7f,0x7f,0x00); case Operator: case UnclosedString: return QColor(0x00,0x00,0x00); case Identifier: break; case Regex: return QColor(0x3f,0x7f,0x3f); case CommentDocKeyword: return QColor(0x30,0x60,0xa0); case CommentDocKeywordError: return QColor(0x80,0x40,0x20); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerCPP::defaultEolFill(int style) const { if (style == UnclosedString) return true; return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerCPP::defaultFont(int style) const { QFont f; switch (style) { case Comment: case CommentLine: case CommentDoc: case CommentLineDoc: case CommentDocKeyword: case CommentDocKeywordError: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case Keyword: case Operator: f = QsciLexer::defaultFont(style); f.setBold(true); break; case DoubleQuotedString: case SingleQuotedString: case UnclosedString: #if defined(Q_OS_WIN) f = QFont("Courier New",10); #else f = QFont("Bitstream Vera Sans Mono",9); #endif break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerCPP::keywords(int set) const { if (set == 1) return "and and_eq asm auto bitand bitor bool break case " "catch char class compl const const_cast continue " "default delete do double dynamic_cast else enum " "explicit export extern false float for friend goto if " "inline int long mutable namespace new not not_eq " "operator or or_eq private protected public register " "reinterpret_cast return short signed sizeof static " "static_cast struct switch template this throw true " "try typedef typeid typename union unsigned using " "virtual void volatile wchar_t while xor xor_eq"; if (set == 3) return "a addindex addtogroup anchor arg attention author b " "brief bug c class code date def defgroup deprecated " "dontinclude e em endcode endhtmlonly endif " "endlatexonly endlink endverbatim enum example " "exception f$ f[ f] file fn hideinitializer " "htmlinclude htmlonly if image include ingroup " "internal invariant interface latexonly li line link " "mainpage name namespace nosubgrouping note overload " "p page par param post pre ref relates remarks return " "retval sa section see showinitializer since skip " "skipline struct subsection test throw todo typedef " "union until var verbatim verbinclude version warning " "weakgroup $ @ \\ & < > # { }"; return 0; } // Returns the user name of a style. QString QsciLexerCPP::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("C comment"); case CommentLine: return tr("C++ comment"); case CommentDoc: return tr("JavaDoc style C comment"); case Number: return tr("Number"); case Keyword: return tr("Keyword"); case DoubleQuotedString: return tr("Double-quoted string"); case SingleQuotedString: return tr("Single-quoted string"); case PreProcessor: return tr("Pre-processor block"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case UnclosedString: return tr("Unclosed string"); case CommentLineDoc: return tr("JavaDoc style C++ comment"); case KeywordSet2: return tr("Secondary keywords and identifiers"); case CommentDocKeyword: return tr("JavaDoc keyword"); case CommentDocKeywordError: return tr("JavaDoc keyword error"); case GlobalClass: return tr("Global classes and typedefs"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerCPP::defaultPaper(int style) const { if (style == UnclosedString) return QColor(0xe0,0xc0,0xe0); return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerCPP::refreshProperties() { setAtElseProp(); setCommentProp(); setCompactProp(); setPreprocProp(); setStylePreprocProp(); } // Read properties from the settings. bool QsciLexerCPP::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_atelse = qs.value(prefix + "foldatelse", false).toBool(); fold_comments = qs.value(prefix + "foldcomments", false).toBool(); fold_compact = qs.value(prefix + "foldcompact", true).toBool(); fold_preproc = qs.value(prefix + "foldpreprocessor", true).toBool(); style_preproc = qs.value(prefix + "stylepreprocessor", false).toBool(); return rc; } // Write properties to the settings. bool QsciLexerCPP::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldatelse", fold_atelse); qs.setValue(prefix + "foldcomments", fold_comments); qs.setValue(prefix + "foldcompact", fold_compact); qs.setValue(prefix + "foldpreprocessor", fold_preproc); qs.setValue(prefix + "stylepreprocessor", style_preproc); return rc; } // Return true if else can be folded. bool QsciLexerCPP::foldAtElse() const { return fold_atelse; } // Set if else can be folded. void QsciLexerCPP::setFoldAtElse(bool fold) { fold_atelse = fold; setAtElseProp(); } // Set the "fold.at.else" property. void QsciLexerCPP::setAtElseProp() { emit propertyChanged("fold.at.else",(fold_atelse ? "1" : "0")); } // Return true if comments can be folded. bool QsciLexerCPP::foldComments() const { return fold_comments; } // Set if comments can be folded. void QsciLexerCPP::setFoldComments(bool fold) { fold_comments = fold; setCommentProp(); } // Set the "fold.comment" property. void QsciLexerCPP::setCommentProp() { emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); } // Return true if folds are compact. bool QsciLexerCPP::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerCPP::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerCPP::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } // Return true if preprocessor blocks can be folded. bool QsciLexerCPP::foldPreprocessor() const { return fold_preproc; } // Set if preprocessor blocks can be folded. void QsciLexerCPP::setFoldPreprocessor(bool fold) { fold_preproc = fold; setPreprocProp(); } // Set the "fold.preprocessor" property. void QsciLexerCPP::setPreprocProp() { emit propertyChanged("fold.preprocessor",(fold_preproc ? "1" : "0")); } // Return true if preprocessor lines are styled. bool QsciLexerCPP::stylePreprocessor() const { return style_preproc; } // Set if preprocessor lines are styled. void QsciLexerCPP::setStylePreprocessor(bool style) { style_preproc = style; setStylePreprocProp(); } // Set the "style.within.preprocessor" property. void QsciLexerCPP::setStylePreprocProp() { emit propertyChanged("style.within.preprocessor",(style_preproc ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerbatch.cpp0000644000175000001440000001041311407213302023510 0ustar subzerousers// This module implements the QsciLexerBatch class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerbatch.h" #include #include #include // The ctor. QsciLexerBatch::QsciLexerBatch(QObject *parent) : QsciLexer(parent) { } // The dtor. QsciLexerBatch::~QsciLexerBatch() { } // Returns the language name. const char *QsciLexerBatch::language() const { return "Batch"; } // Returns the lexer name. const char *QsciLexerBatch::lexer() const { return "batch"; } // Return the string of characters that comprise a word. const char *QsciLexerBatch::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"; } // Returns the foreground colour of the text for a style. QColor QsciLexerBatch::defaultColor(int style) const { switch (style) { case Default: case Operator: return QColor(0x00,0x00,0x00); case Comment: return QColor(0x00,0x7f,0x00); case Keyword: case ExternalCommand: return QColor(0x00,0x00,0x7f); case Label: return QColor(0x7f,0x00,0x7f); case HideCommandChar: return QColor(0x7f,0x7f,0x00); case Variable: return QColor(0x80,0x00,0x80); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerBatch::defaultEolFill(int style) const { switch (style) { case Label: return true; } return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerBatch::defaultFont(int style) const { QFont f; switch (style) { case Comment: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case Keyword: f = QsciLexer::defaultFont(style); f.setBold(true); break; case ExternalCommand: #if defined(Q_OS_WIN) f = QFont("Courier New",10); #else f = QFont("Bitstream Vera Sans Mono",9); #endif f.setBold(true); break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerBatch::keywords(int set) const { if (set == 1) return "rem set if exist errorlevel for in do break call " "chcp cd chdir choice cls country ctty date del " "erase dir echo exit goto loadfix loadhigh mkdir md " "move path pause prompt rename ren rmdir rd shift " "time type ver verify vol com con lpt nul"; return 0; } // Return the case sensitivity. bool QsciLexerBatch::caseSensitive() const { return false; } // Returns the user name of a style. QString QsciLexerBatch::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case Keyword: return tr("Keyword"); case Label: return tr("Label"); case HideCommandChar: return tr("Hide command character"); case ExternalCommand: return tr("External command"); case Variable: return tr("Variable"); case Operator: return tr("Operator"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerBatch::defaultPaper(int style) const { switch (style) { case Label: return QColor(0x60,0x60,0x60); } return QsciLexer::defaultPaper(style); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerdiff.cpp0000644000175000001440000000506511407213302023346 0ustar subzerousers// This module implements the QsciLexerDiff class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerdiff.h" #include #include #include // The ctor. QsciLexerDiff::QsciLexerDiff(QObject *parent) : QsciLexer(parent) { } // The dtor. QsciLexerDiff::~QsciLexerDiff() { } // Returns the language name. const char *QsciLexerDiff::language() const { return "Diff"; } // Returns the lexer name. const char *QsciLexerDiff::lexer() const { return "diff"; } // Return the string of characters that comprise a word. const char *QsciLexerDiff::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"; } // Returns the foreground colour of the text for a style. QColor QsciLexerDiff::defaultColor(int style) const { switch (style) { case Default: return QColor(0x00,0x00,0x00); case Comment: return QColor(0x00,0x7f,0x00); case Command: return QColor(0x7f,0x7f,0x00); case Header: return QColor(0x7f,0x00,0x00); case Position: return QColor(0x7f,0x00,0x7f); case LineRemoved: return QColor(0x00,0x7f,0x7f); case LineAdded: return QColor(0x00,0x00,0x7f); } return QsciLexer::defaultColor(style); } // Returns the user name of a style. QString QsciLexerDiff::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case Command: return tr("Command"); case Header: return tr("Header"); case Position: return tr("Position"); case LineRemoved: return tr("Removed line"); case LineAdded: return tr("Added line"); } return QString(); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexermakefile.cpp0000644000175000001440000000642511407213302024214 0ustar subzerousers// This module implements the QsciLexerMakefile class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexermakefile.h" #include #include // The ctor. QsciLexerMakefile::QsciLexerMakefile(QObject *parent) : QsciLexer(parent) { } // The dtor. QsciLexerMakefile::~QsciLexerMakefile() { } // Returns the language name. const char *QsciLexerMakefile::language() const { return "Makefile"; } // Returns the lexer name. const char *QsciLexerMakefile::lexer() const { return "makefile"; } // Return the string of characters that comprise a word. const char *QsciLexerMakefile::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"; } // Returns the foreground colour of the text for a style. QColor QsciLexerMakefile::defaultColor(int style) const { switch (style) { case Default: case Operator: return QColor(0x00,0x00,0x00); case Comment: return QColor(0x00,0x7f,0x00); case Preprocessor: return QColor(0x7f,0x7f,0x00); case Variable: return QColor(0x00,0x00,0x80); case Target: return QColor(0xa0,0x00,0x00); case Error: return QColor(0xff,0xff,0x00); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerMakefile::defaultEolFill(int style) const { if (style == Error) return true; return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerMakefile::defaultFont(int style) const { QFont f; if (style == Comment) #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif else f = QsciLexer::defaultFont(style); return f; } // Returns the user name of a style. QString QsciLexerMakefile::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case Preprocessor: return tr("Preprocessor"); case Variable: return tr("Variable"); case Operator: return tr("Operator"); case Target: return tr("Target"); case Error: return tr("Error"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerMakefile::defaultPaper(int style) const { if (style == Error) return QColor(0xff,0x00,0x00); return QsciLexer::defaultPaper(style); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerbash.cpp0000644000175000001440000001754711407213302023363 0ustar subzerousers// This module implements the QsciLexerBash class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerbash.h" #include #include #include // The ctor. QsciLexerBash::QsciLexerBash(QObject *parent) : QsciLexer(parent), fold_comments(false), fold_compact(true) { } // The dtor. QsciLexerBash::~QsciLexerBash() { } // Returns the language name. const char *QsciLexerBash::language() const { return "Bash"; } // Returns the lexer name. const char *QsciLexerBash::lexer() const { return "bash"; } // Return the style used for braces. int QsciLexerBash::braceStyle() const { return Operator; } // Return the string of characters that comprise a word. const char *QsciLexerBash::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$@%&"; } // Returns the foreground colour of the text for a style. QColor QsciLexerBash::defaultColor(int style) const { switch (style) { case Default: return QColor(0x80,0x80,0x80); case Error: case Backticks: return QColor(0xff,0xff,0x00); case Comment: return QColor(0x00,0x7f,0x00); case Number: return QColor(0x00,0x7f,0x7f); case Keyword: return QColor(0x00,0x00,0x7f); case DoubleQuotedString: case SingleQuotedString: case SingleQuotedHereDocument: return QColor(0x7f,0x00,0x7f); case Operator: case Identifier: case Scalar: case ParameterExpansion: case HereDocumentDelimiter: return QColor(0x00,0x00,0x00); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerBash::defaultEolFill(int style) const { switch (style) { case SingleQuotedHereDocument: return true; } return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerBash::defaultFont(int style) const { QFont f; switch (style) { case Comment: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case Keyword: case Operator: f = QsciLexer::defaultFont(style); f.setBold(true); break; case DoubleQuotedString: case SingleQuotedString: #if defined(Q_OS_WIN) f = QFont("Courier New",10); #else f = QFont("Bitstream Vera Sans Mono",9); #endif break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerBash::keywords(int set) const { if (set == 1) return "alias ar asa awk banner basename bash bc bdiff break " "bunzip2 bzip2 cal calendar case cat cc cd chmod " "cksum clear cmp col comm compress continue cp cpio " "crypt csplit ctags cut date dc dd declare deroff dev " "df diff diff3 dircmp dirname do done du echo ed " "egrep elif else env esac eval ex exec exit expand " "export expr false fc fgrep fi file find fmt fold for " "function functions getconf getopt getopts grep gres " "hash head help history iconv id if in integer jobs " "join kill local lc let line ln logname look ls m4 " "mail mailx make man mkdir more mt mv newgrp nl nm " "nohup ntps od pack paste patch pathchk pax pcat perl " "pg pr print printf ps pwd read readonly red return " "rev rm rmdir sed select set sh shift size sleep sort " "spell split start stop strings strip stty sum " "suspend sync tail tar tee test then time times touch " "tr trap true tsort tty type typeset ulimit umask " "unalias uname uncompress unexpand uniq unpack unset " "until uudecode uuencode vi vim vpax wait wc whence " "which while who wpaste wstart xargs zcat " "chgrp chown chroot dir dircolors factor groups " "hostid install link md5sum mkfifo mknod nice pinky " "printenv ptx readlink seq sha1sum shred stat su tac " "unlink users vdir whoami yes"; return 0; } // Returns the user name of a style. QString QsciLexerBash::description(int style) const { switch (style) { case Default: return tr("Default"); case Error: return tr("Error"); case Comment: return tr("Comment"); case Number: return tr("Number"); case Keyword: return tr("Keyword"); case DoubleQuotedString: return tr("Double-quoted string"); case SingleQuotedString: return tr("Single-quoted string"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case Scalar: return tr("Scalar"); case ParameterExpansion: return tr("Parameter expansion"); case Backticks: return tr("Backticks"); case HereDocumentDelimiter: return tr("Here document delimiter"); case SingleQuotedHereDocument: return tr("Single-quoted here document"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerBash::defaultPaper(int style) const { switch (style) { case Error: return QColor(0xff,0x00,0x00); case Scalar: return QColor(0xff,0xe0,0xe0); case ParameterExpansion: return QColor(0xff,0xff,0xe0); case Backticks: return QColor(0xa0,0x80,0x80); case HereDocumentDelimiter: case SingleQuotedHereDocument: return QColor(0xdd,0xd0,0xdd); } return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerBash::refreshProperties() { setCommentProp(); setCompactProp(); } // Read properties from the settings. bool QsciLexerBash::readProperties(QSettings &qs, const QString &prefix) { int rc = true; fold_comments = qs.value(prefix + "foldcomments", false).toBool(); fold_compact = qs.value(prefix + "foldcompact", true).toBool(); return rc; } // Write properties to the settings. bool QsciLexerBash::writeProperties(QSettings &qs, const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldcomments", fold_comments); qs.setValue(prefix + "foldcompact", fold_compact); return rc; } // Return true if comments can be folded. bool QsciLexerBash::foldComments() const { return fold_comments; } // Set if comments can be folded. void QsciLexerBash::setFoldComments(bool fold) { fold_comments = fold; setCommentProp(); } // Set the "fold.comment" property. void QsciLexerBash::setCommentProp() { emit propertyChanged("fold.comment", (fold_comments ? "1" : "0")); } // Return true if folds are compact. bool QsciLexerBash::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerBash::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerBash::setCompactProp() { emit propertyChanged("fold.compact", (fold_compact ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/PlatQt.cpp0000644000175000001440000005132711407213302021725 0ustar subzerousers// This module implements the portability layer for the Qt port of Scintilla. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Platform.h" #include "XPM.h" #include "Qsci/qsciscintillabase.h" #include "SciClasses.h" // Type convertors. static QFont *PFont(FontID id) { return reinterpret_cast(id); } static QWidget *PWindow(WindowID id) { return reinterpret_cast(id); } static SciPopup *PMenu(MenuID id) { return reinterpret_cast(id); } // Create a Point instance from a long value. Point Point::FromLong(long lpoint) { return Point(Platform::LowShortFromLong(lpoint), Platform::HighShortFromLong(lpoint)); } // Colour palette management. The Qt interface to colours means this class // doesn't have to do anything. Palette::Palette() { used = 0; allowRealization = false; } Palette::~Palette() { Release(); } void Palette::Release() { used = 0; } void Palette::WantFind(ColourPair &cp, bool want) { if (!want) cp.allocated.Set(cp.desired.AsLong()); } void Palette::Allocate(Window &) { } // Font management. Font::Font() : id(0) { } Font::~Font() { } void Font::Create(const char *faceName, int, int size, bool bold, bool italic, bool) { Release(); QFont *f = new QFont(); // If name of the font begins with a '-', assume, that it is an XLFD. if (faceName[0] == '-') f->setRawName(faceName); else { f->setFamily(faceName); f->setPointSize(size); f->setBold(bold); f->setItalic(italic); } id = f; } void Font::Release() { if (id) { delete PFont(id); id = 0; } } // A surface abstracts a place to draw. class SurfaceImpl : public Surface { public: SurfaceImpl(); virtual ~SurfaceImpl(); void Init(WindowID wid); void Init(SurfaceID sid, WindowID); void Init(QPainter *p); void InitPixMap(int width, int height, Surface *, WindowID); void Release(); bool Initialised() {return painter;} void PenColour(ColourAllocated fore); int LogPixelsY() {return 72;} int DeviceHeightFont(int points) {return points;} void MoveTo(int x_,int y_); void LineTo(int x_,int y_); void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back); void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back); void FillRectangle(PRectangle rc, ColourAllocated back); void FillRectangle(PRectangle rc, Surface &surfacePattern); void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back); void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, ColourAllocated outline, int alphaOutline, int flags); void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back); void Copy(PRectangle rc, Point from, Surface &surfaceSource); void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore); void MeasureWidths(Font &font_, const char *s, int len, int *positions); int WidthText(Font &font_, const char *s, int len); int WidthChar(Font &font_, char ch); int Ascent(Font &font_); int Descent(Font &font_); int InternalLeading(Font &font_) {return 0;} int ExternalLeading(Font &font_); int Height(Font &font_); int AverageCharWidth(Font &font_) {return WidthChar(font_, 'n');} int SetPalette(Palette *, bool) {return 0;} void SetClip(PRectangle rc); void FlushCachedState(); void SetUnicodeMode(bool unicodeMode_) {unicodeMode = unicodeMode_;} void SetDBCSMode(int codePage) {} void DrawXPM(PRectangle rc, const XPM *xpm); private: QFontMetrics metrics(Font &font_); QString convertText(const char *s, int len); static QRgb convertQRgb(const ColourAllocated &col, unsigned alpha); static QColor convertQColor(const ColourAllocated &col, unsigned alpha = 0xff); bool unicodeMode; QPaintDevice *pd; QPainter *painter; bool my_resources; int pen_x, pen_y; }; Surface *Surface::Allocate() { return new SurfaceImpl; } SurfaceImpl::SurfaceImpl() : unicodeMode(false), pd(0), painter(0), my_resources(false), pen_x(0), pen_y(0) { } SurfaceImpl::~SurfaceImpl() { Release(); } void SurfaceImpl::Init(WindowID wid) { Release(); pd = reinterpret_cast(wid); } void SurfaceImpl::Init(SurfaceID sid, WindowID) { Release(); // This method, and the SurfaceID type, is only used when printing. As it // is actually a void * we pass (when using SCI_FORMATRANGE) a pointer to a // QPainter rather than a pointer to a SurfaceImpl as might be expected. QPainter *p = reinterpret_cast(sid); pd = p->device(); painter = p; } void SurfaceImpl::Init(QPainter *p) { Release(); pd = p->device(); painter = p; } void SurfaceImpl::InitPixMap(int width, int height, Surface *, WindowID) { Release(); pd = new QPixmap(width, height); painter = new QPainter(pd); my_resources = true; } void SurfaceImpl::Release() { if (my_resources) { if (painter) delete painter; if (pd) delete pd; my_resources = false; } painter = 0; pd = 0; } void SurfaceImpl::MoveTo(int x_, int y_) { Q_ASSERT(painter); pen_x = x_; pen_y = y_; } void SurfaceImpl::LineTo(int x_, int y_) { Q_ASSERT(painter); painter->drawLine(pen_x, pen_y, x_, y_); pen_x = x_; pen_y = y_; } void SurfaceImpl::PenColour(ColourAllocated fore) { Q_ASSERT(painter); painter->setPen(convertQColor(fore)); } void SurfaceImpl::Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back) { Q_ASSERT(painter); QPolygon qpts(npts); for (int i = 0; i < npts; ++i) qpts.setPoint(i, pts[i].x, pts[i].y); painter->setPen(convertQColor(fore)); painter->setBrush(convertQColor(back)); painter->drawPolygon(qpts); } void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back) { Q_ASSERT(painter); painter->setPen(convertQColor(fore)); painter->setBrush(convertQColor(back)); painter->drawRect(rc.left, rc.top, rc.right - rc.left - 1, rc.bottom - rc.top - 1); } void SurfaceImpl::FillRectangle(PRectangle rc, ColourAllocated back) { Q_ASSERT(painter); painter->setPen(Qt::NoPen); painter->setBrush(convertQColor(back)); painter->drawRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); } void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) { Q_ASSERT(painter); SurfaceImpl &si = static_cast(surfacePattern); QPixmap *pm = static_cast(si.pd); if (pm) { QBrush brsh(Qt::black, *pm); painter->setPen(Qt::NoPen); painter->setBrush(brsh); painter->drawRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); } else FillRectangle(rc, ColourAllocated(0)); } void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back) { Q_ASSERT(painter); painter->setPen(convertQColor(fore)); painter->setBrush(convertQColor(back)); painter->drawRoundRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); } void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, ColourAllocated outline, int alphaOutline, int) { Q_ASSERT(painter); int w = rc.right - rc.left; int h = rc.bottom - rc.top; // Assume that "cornerSize" means outline width. if (cornerSize > 0) painter->setPen(QPen(QColor(convertQRgb(outline, alphaOutline)), cornerSize)); else painter->setPen(Qt::NoPen); painter->setBrush(QColor(convertQRgb(fill, alphaFill))); painter->drawRect(rc.left, rc.top, w, h); } void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { Q_ASSERT(painter); painter->setPen(convertQColor(fore)); painter->setBrush(convertQColor(back)); painter->drawEllipse(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); } void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) { Q_ASSERT(painter); SurfaceImpl &si = static_cast(surfaceSource); if (si.pd) { QPixmap *pm = static_cast(si.pd); painter->drawPixmap(rc.left, rc.top, *pm, from.x, from.y, rc.right - rc.left, rc.bottom - rc.top); } } void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len,ColourAllocated fore, ColourAllocated back) { Q_ASSERT(painter); FillRectangle(rc, back); DrawTextTransparent(rc, font_, ybase, s, len, fore); } void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back) { Q_ASSERT(painter); SetClip(rc); DrawTextNoClip(rc, font_, ybase, s, len, fore, back); painter->setClipping(false); } void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore) { Q_ASSERT(painter); QString qs = convertText(s, len); QFont *f = PFont(font_.GetID()); if (f) painter->setFont(*f); painter->setPen(convertQColor(fore)); painter->drawText(rc.left, ybase, qs); } void SurfaceImpl::DrawXPM(PRectangle rc, const XPM *xpm) { Q_ASSERT(painter); int x, y; const QPixmap &qpm = xpm->Pixmap(); x = rc.left + (rc.Width() - qpm.width()) / 2; y = rc.top + (rc.Height() - qpm.height()) / 2; painter->drawPixmap(x, y, qpm); } void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, int *positions) { QFontMetrics fm = metrics(font_); QString qs = convertText(s, len); int totalWidth = 0, ui = 0; for (int i = 0; i < qs.length(); ++i) { totalWidth += fm.width(qs[i]); int l = (unicodeMode ? QString(qs[i]).toUtf8().length() : 1); while (l--) positions[ui++] = totalWidth; } } int SurfaceImpl::WidthText(Font &font_, const char *s, int len) { QString qs = convertText(s, len); return metrics(font_).width(qs, qs.length()); } int SurfaceImpl::WidthChar(Font &font_, char ch) { return metrics(font_).width(ch); } int SurfaceImpl::Ascent(Font &font_) { return metrics(font_).ascent(); } int SurfaceImpl::Descent(Font &font_) { // Qt doesn't include the baseline in the descent, so add it. Note that // a descent from Qt4 always seems to be 2 pixels larger (irrespective of // font or size) than the same descent from Qt3. This means that text is a // little more spaced out with Qt4 - and will be more noticeable with // smaller fonts. return metrics(font_).descent() + 1; } int SurfaceImpl::ExternalLeading(Font &font_) { // Scintilla doesn't use this at the moment, which is good because Qt4 can // return a negative value. return metrics(font_).leading(); } int SurfaceImpl::Height(Font &font_) { return metrics(font_).height(); } void SurfaceImpl::SetClip(PRectangle rc) { Q_ASSERT(painter); painter->setClipRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); } void SurfaceImpl::FlushCachedState() { } // Get the metrics for a font. QFontMetrics SurfaceImpl::metrics(Font &font_) { QFont *f = PFont(font_.GetID()), fnt; if (f) fnt = *f; else fnt = QApplication::font(); return QFontMetrics(fnt, pd); } // Convert a Scintilla string to a Qt Unicode string. QString SurfaceImpl::convertText(const char *s, int len) { if (unicodeMode) return QString::fromUtf8(s, len); return QString::fromLatin1(s, len); } // Convert a Scintilla colour and alpha component to a Qt QRgb. QRgb SurfaceImpl::convertQRgb(const ColourAllocated &col, unsigned alpha) { long c = col.AsLong(); unsigned r = c & 0xff; unsigned g = (c >> 8) & 0xff; unsigned b = (c >> 16) & 0xff; QRgb rgba = (alpha << 24) | (r << 16) | (g << 8) | b; return rgba; } // Convert a Scintilla colour, and optional alpha component, to a Qt QColor. QColor SurfaceImpl::convertQColor(const ColourAllocated &col, unsigned alpha) { return QColor(convertQRgb(col, alpha)); } // Window (widget) management. Window::~Window() { } void Window::Destroy() { QWidget *w = PWindow(id); if (w) { // Delete the widget next time round the event loop rather than // straight away. This gets round a problem when auto-completion lists // are cancelled after an entry has been double-clicked, ie. the list's // dtor is called from one of the list's slots. There are other ways // around the problem but this is the simplest and doesn't seem to // cause problems of its own. w->deleteLater(); id = 0; } } bool Window::HasFocus() { return PWindow(id)->hasFocus(); } PRectangle Window::GetPosition() { QWidget *w = PWindow(id); // Before any size allocated pretend its big enough not to be scrolled. PRectangle rc(0,0,5000,5000); if (w) { const QRect &r = w->geometry(); rc.right = r.right() - r.left() + 1; rc.bottom = r.bottom() - r.top() + 1; } return rc; } void Window::SetPosition(PRectangle rc) { PWindow(id)->setGeometry(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); } void Window::SetPositionRelative(PRectangle rc, Window relativeTo) { QWidget *rel = PWindow(relativeTo.id); QPoint pos = rel->mapToGlobal(rel->pos()); int x = pos.x() + rc.left; int y = pos.y() + rc.top; PWindow(id)->setGeometry(x, y, rc.right - rc.left, rc.bottom - rc.top); } PRectangle Window::GetClientPosition() { return GetPosition(); } void Window::Show(bool show) { QWidget *w = PWindow(id); if (show) w->show(); else w->hide(); } void Window::InvalidateAll() { QWidget *w = PWindow(id); if (w) w->update(); } void Window::InvalidateRectangle(PRectangle rc) { QWidget *w = PWindow(id); if (w) w->update(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); } void Window::SetFont(Font &font) { PWindow(id)->setFont(*PFont(font.GetID())); } void Window::SetCursor(Cursor curs) { Qt::CursorShape qc; switch (curs) { case cursorText: qc = Qt::IBeamCursor; break; case cursorUp: qc = Qt::UpArrowCursor; break; case cursorWait: qc = Qt::WaitCursor; break; case cursorHoriz: qc = Qt::SizeHorCursor; break; case cursorVert: qc = Qt::SizeVerCursor; break; case cursorHand: qc = Qt::PointingHandCursor; break; default: qc = Qt::ArrowCursor; } PWindow(id)->setCursor(qc); } void Window::SetTitle(const char *s) { PWindow(id)->setWindowTitle(s); } // Menu management. Menu::Menu() : id(0) { } void Menu::CreatePopUp() { Destroy(); id = new SciPopup(); } void Menu::Destroy() { SciPopup *m = PMenu(id); if (m) { delete m; id = 0; } } void Menu::Show(Point pt, Window &) { PMenu(id)->popup(QPoint(pt.x, pt.y)); } class DynamicLibraryImpl : public DynamicLibrary { public: DynamicLibraryImpl(const char *modulePath) { m = new QLibrary(modulePath); m->load(); } virtual ~DynamicLibraryImpl() { if (m) delete m; } virtual Function FindFunction(const char *name) { if (m) return m->resolve(name); return 0; } virtual bool IsValid() { return m && m->isLoaded(); } private: QLibrary* m; }; DynamicLibrary *DynamicLibrary::Load(const char *modulePath) { return new DynamicLibraryImpl(modulePath); } // Elapsed time. This implementation assumes that the maximum elapsed time is // less than 48 hours. ElapsedTime::ElapsedTime() { QTime now = QTime::currentTime(); bigBit = now.hour() * 60 * 60 + now.minute() * 60 + now.second(); littleBit = now.msec(); } double ElapsedTime::Duration(bool reset) { long endBigBit, endLittleBit; QTime now = QTime::currentTime(); endBigBit = now.hour() * 60 * 60 + now.minute() * 60 + now.second(); endLittleBit = now.msec(); double duration = endBigBit - bigBit; if (duration < 0 || (duration == 0 && endLittleBit < littleBit)) duration += 24 * 60 * 60; duration += (endLittleBit - littleBit) / 1000.0; if (reset) { bigBit = endBigBit; littleBit = endLittleBit; } return duration; } // Manage system wide parameters. ColourDesired Platform::Chrome() { return ColourDesired(0xe0,0xe0,0xe0); } ColourDesired Platform::ChromeHighlight() { return ColourDesired(0xff,0xff,0xff); } const char *Platform::DefaultFont() { static QByteArray def_font; def_font = QApplication::font().family().toAscii(); return def_font.constData(); } int Platform::DefaultFontSize() { return QApplication::font().pointSize(); } unsigned int Platform::DoubleClickTime() { return QApplication::doubleClickInterval(); } bool Platform::MouseButtonBounce() { return true; } #if defined(__APPLE__) bool Platform::WaitMouseMoved(Point pt) { // For the moment don't call ::WaitMouseMoved() and see if anybody // complains. If we need it then we will need to define SCI_NAMESPACE. // However the proper solution would be to use QApplication's // startDragTime() and startDragDistance() for all platforms. return true; } #endif void Platform::DebugDisplay(const char *s) { qDebug("%s", s); } bool Platform::IsKeyDown(int) { return false; } long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) { return static_cast(PWindow(w)->parentWidget())->SendScintilla(msg, wParam, lParam); } long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) { return static_cast(PWindow(w)->parentWidget())->SendScintilla(msg, wParam, reinterpret_cast(lParam)); } bool Platform::IsDBCSLeadByte(int, char) { // We don't support DBCS. return false; } int Platform::DBCSCharLength(int, const char *) { // We don't support DBCS. return 1; } int Platform::DBCSCharMaxLength() { // We don't support DBCS. return 2; } int Platform::Minimum(int a, int b) { return (a < b) ? a : b; } int Platform::Maximum(int a, int b) { return (a > b) ? a : b; } int Platform::Clamp(int val, int minVal, int maxVal) { if (val > maxVal) val = maxVal; if (val < minVal) val = minVal; return val; } //#define TRACE #ifdef TRACE void Platform::DebugPrintf(const char *format, ...) { char buffer[2000]; va_list pArguments; va_start(pArguments, format); vsprintf(buffer, format, pArguments); va_end(pArguments); DebugDisplay(buffer); } #else void Platform::DebugPrintf(const char *, ...) { } #endif static bool assertionPopUps = true; bool Platform::ShowAssertionPopUps(bool assertionPopUps_) { bool ret = assertionPopUps; assertionPopUps = assertionPopUps_; return ret; } void Platform::Assert(const char *c, const char *file, int line) { qFatal("Assertion [%s] failed at %s %d\n", c, file, line); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscimacro.cpp0000644000175000001440000001470311407213302022476 0ustar subzerousers// This module implements the QsciMacro class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscimacro.h" #include #include "Qsci/qsciscintilla.h" static int fromHex(unsigned char ch); // The ctor. QsciMacro::QsciMacro(QsciScintilla *parent) : QObject(parent), qsci(parent) { } // The ctor that initialises the macro. QsciMacro::QsciMacro(const QString &asc, QsciScintilla *parent) : QObject(parent), qsci(parent) { load(asc); } // The dtor. QsciMacro::~QsciMacro() { } // Clear the contents of the macro. void QsciMacro::clear() { macro.clear(); } // Read a macro from a string. bool QsciMacro::load(const QString &asc) { bool ok = true; macro.clear(); QStringList fields = asc.split(' '); int f = 0; while (f < fields.size()) { Macro cmd; unsigned len; // Extract the 3 fixed fields. if (f + 3 > fields.size()) { ok = false; break; } cmd.msg = fields[f++].toUInt(&ok); if (!ok) break; cmd.wParam = fields[f++].toULong(&ok); if (!ok) break; len = fields[f++].toUInt(&ok); if (!ok) break; // Extract any text. if (len) { if (f + 1 > fields.size()) { ok = false; break; } cmd.text.resize(len - 1); QByteArray ba = fields[f++].toAscii(); const char *sp = ba.data(); char *dp = cmd.text.data(); if (!sp) { ok = false; break; } while (len--) { unsigned char ch; ch = *sp++; if (ch == '"' || ch <= ' ' || ch >= 0x7f) { ok = false; break; } if (ch == '\\') { int b1, b2; if ((b1 = fromHex(*sp++)) < 0 || (b2 = fromHex(*sp++)) < 0) { ok = false; break; } ch = (b1 << 4) + b2; } *dp++ = ch; } if (!ok) break; } macro.append(cmd); } if (!ok) macro.clear(); return ok; } // Write a macro to a string. QString QsciMacro::save() const { QString ms; QList::const_iterator it; for (it = macro.begin(); it != macro.end(); ++it) { if (!ms.isEmpty()) ms += ' '; unsigned len = (*it).text.size(); QString m; ms += m.sprintf("%u %lu %u", (*it).msg, (*it).wParam, len); if (len) { // In Qt v3, if the length is greater than zero then it also // includes the '\0', so we need to make sure that Qt v4 writes the // '\0'. (That the '\0' is written at all is probably a historical // bug - using size() instead of length() which we don't fix so as // not to break old macros.) ++len; ms += ' '; const char *cp = (*it).text.data(); while (len--) { unsigned char ch = *cp++; if (ch == '\\' || ch == '"' || ch <= ' ' || ch >= 0x7f) { QString buf; ms += buf.sprintf("\\%02x", ch); } else ms += ch; } } } return ms; } // Play the macro. void QsciMacro::play() { if (!qsci) return; QList::const_iterator it; for (it = macro.begin(); it != macro.end(); ++it) qsci->SendScintilla((*it).msg, (*it).wParam, (*it).text.data()); } // Start recording. void QsciMacro::startRecording() { if (!qsci) return; macro.clear(); connect(qsci, SIGNAL(SCN_MACRORECORD(unsigned int, unsigned long, long)), SLOT(record(unsigned int, unsigned long, long))); qsci->SendScintilla(QsciScintillaBase::SCI_STARTRECORD); } // End recording. void QsciMacro::endRecording() { if (!qsci) return; qsci->SendScintilla(QsciScintillaBase::SCI_STOPRECORD); qsci->disconnect(this); } // Record a command. void QsciMacro::record(unsigned int msg, unsigned long wParam, long lParam) { Macro m; m.msg = msg; m.wParam = wParam; // Determine commands which need special handling of the parameters. switch (msg) { case QsciScintillaBase::SCI_ADDTEXT: m.text = QByteArray(reinterpret_cast(lParam), wParam); break; case QsciScintillaBase::SCI_REPLACESEL: if (!macro.isEmpty() && macro.last().msg == QsciScintillaBase::SCI_REPLACESEL) { // This is the command used for ordinary user input so it's a // significant space reduction to append it to the previous // command. macro.last().text.append(reinterpret_cast(lParam)); return; } /* Drop through. */ case QsciScintillaBase::SCI_INSERTTEXT: case QsciScintillaBase::SCI_APPENDTEXT: case QsciScintillaBase::SCI_SEARCHNEXT: case QsciScintillaBase::SCI_SEARCHPREV: m.text.append(reinterpret_cast(lParam)); break; } macro.append(m); } // Return the given hex character as a binary. static int fromHex(unsigned char ch) { if (ch >= '0' && ch <= '9') return ch - '0'; if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10; return -1; } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/0000755000175000001440000000000011407213302020703 5ustar subzerouserssqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexertex.h0000644000175000001440000000532211407213302023576 0ustar subzerousers// This defines the interface to the QsciLexerTeX class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERTEX_H #define QSCILEXERTEX_H extern "C++" { #include #include #include //! \brief The QsciLexerTeX class encapsulates the Scintilla TeX lexer. class QSCINTILLA_EXPORT QsciLexerTeX : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! TeX lexer. enum { //! The default. Default = 0, //! A special. Special = 1, //! A group. Group = 2, //! A symbol. Symbol = 3, //! A command. Command = 4, //! Text. Text = 5 }; //! Construct a QsciLexerTeX with parent \a parent. \a parent is typically //! the QsciScintilla instance. QsciLexerTeX(QObject *parent = 0); //! Destroys the QsciLexerTeX instance. virtual ~QsciLexerTeX(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. QColor defaultColor(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; private: QsciLexerTeX(const QsciLexerTeX &); QsciLexerTeX &operator=(const QsciLexerTeX &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerdiff.h0000644000175000001440000000521111407213302023703 0ustar subzerousers// This defines the interface to the QsciLexerDiff class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERDIFF_H #define QSCILEXERDIFF_H extern "C++" { #include #include #include //! \brief The QsciLexerDiff class encapsulates the Scintilla Diff //! lexer. class QSCINTILLA_EXPORT QsciLexerDiff : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! Diff lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A command. Command = 2, //! A header. Header = 3, //! A position. Position = 4, //! A removed line. LineRemoved = 5, //! An added line. LineAdded = 6 }; //! Construct a QsciLexerDiff with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerDiff(QObject *parent = 0); //! Destroys the QsciLexerDiff instance. virtual ~QsciLexerDiff(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. QColor defaultColor(int style) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; private: QsciLexerDiff(const QsciLexerDiff &); QsciLexerDiff &operator=(const QsciLexerDiff &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerjavascript.h0000644000175000001440000000524711407213302025152 0ustar subzerousers// This defines the interface to the QsciLexerJavaScript class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERJSCRIPT_H #define QSCILEXERJSCRIPT_H extern "C++" { #include #include #include //! \brief The QsciLexerJavaScript class encapsulates the Scintilla JavaScript //! lexer. class QSCINTILLA_EXPORT QsciLexerJavaScript : public QsciLexerCPP { Q_OBJECT public: //! Construct a QsciLexerJavaScript with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerJavaScript(QObject *parent = 0); //! Destroys the QsciLexerJavaScript instance. virtual ~QsciLexerJavaScript(); //! Returns the name of the language. const char *language() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; private: friend class QsciLexerHTML; static const char *keywordClass; QsciLexerJavaScript(const QsciLexerJavaScript &); QsciLexerJavaScript &operator=(const QsciLexerJavaScript &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerjava.h0000644000175000001440000000341711407213302023722 0ustar subzerousers// This defines the interface to the QsciLexerJava class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERJAVA_H #define QSCILEXERJAVA_H extern "C++" { #include #include #include //! \brief The QsciLexerJava class encapsulates the Scintilla Java lexer. class QSCINTILLA_EXPORT QsciLexerJava : public QsciLexerCPP { Q_OBJECT public: //! Construct a QsciLexerJava with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerJava(QObject *parent = 0); //! Destroys the QsciLexerJava instance. virtual ~QsciLexerJava(); //! Returns the name of the language. const char *language() const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; private: QsciLexerJava(const QsciLexerJava &); QsciLexerJava &operator=(const QsciLexerJava &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscimacro.h0000644000175000001440000000536611407213302023047 0ustar subzerousers// This defines the interface to the QsciMacro class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCIMACRO_H #define QSCIMACRO_H extern "C++" { #include #include #include #include class QsciScintilla; //! \brief The QsciMacro class represents a sequence of recordable //! editor commands. //! //! Methods are provided to convert convert a macro to and from a textual //! representation so that they can be easily written to and read from //! permanent storage. class QSCINTILLA_EXPORT QsciMacro : public QObject { Q_OBJECT public: //! Construct a QsciMacro with parent \a parent. QsciMacro(QsciScintilla *parent); //! Construct a QsciMacro from the printable ASCII representation \a asc, //! with parent \a parent. QsciMacro(const QString &asc, QsciScintilla *parent); //! Destroy the QsciMacro instance. virtual ~QsciMacro(); //! Clear the contents of the macro. void clear(); //! Load the macro from the printable ASCII representation \a asc. Returns //! true if there was no error. //! //! \sa save() bool load(const QString &asc); //! Return a printable ASCII representation of the macro. It is guaranteed //! that only printable ASCII characters are used and that double quote //! characters will not be used. //! //! \sa load() QString save() const; public slots: //! Play the macro. virtual void play(); //! Start recording user commands and add them to the macro. virtual void startRecording(); //! Stop recording user commands. virtual void endRecording(); private slots: void record(unsigned int msg, unsigned long wParam, long lParam); private: struct Macro { unsigned int msg; unsigned long wParam; QByteArray text; }; QsciScintilla *qsci; QList macro; QsciMacro(const QsciMacro &); QsciMacro &operator=(const QsciMacro &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscicommand.h0000644000175000001440000000623511407213302023360 0ustar subzerousers// This defines the interface to the QsciCommand class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCICOMMAND_H #define QSCICOMMAND_H extern "C++" { #include #include #include class QsciScintilla; //! \brief The QsciCommand class represents an internal editor command that may //! have one or two keys bound to it. //! //! Methods are provided to change the keys bound to the command and to remove //! a key binding. Each command has a user friendly description of the command //! for use in key mapping dialogs. class QSCINTILLA_EXPORT QsciCommand { public: //! Binds the key \a key to the command. If \a key is 0 then the key //! binding is removed. If \a key is invalid then the key binding is //! unchanged. Valid keys are any visible or control character or any //! of \c Key_Down, \c Key_Up, \c Key_Left, \c Key_Right, \c Key_Home, //! \c Key_End, \c Key_PageUp, \c Key_PageDown, \c Key_Delete, //! \c Key_Insert, \c Key_Escape, \c Key_Backspace, \c Key_Tab and //! \c Key_Return. Keys may be modified with any combination of \c SHIFT, //! \c CTRL and \c ALT. //! //! \sa key(), setAlternateKey(), validKey() void setKey(int key); //! Binds the alternate key \a altkey to the command. If \a key is 0 //! then the alternate key binding is removed. //! //! \sa alternateKey(), setKey(), validKey() void setAlternateKey(int altkey); //! The key that is currently bound to the command is returned. //! //! \sa setKey(), alternateKey() int key() const {return qkey;} //! The alternate key that is currently bound to the command is //! returned. //! //! \sa setAlternateKey(), key() int alternateKey() const {return qaltkey;} //! If the key \a key is valid then true is returned. static bool validKey(int key); //! The user friendly description of the command is returned. QString description() const; private: friend class QsciCommandSet; QsciCommand(QsciScintilla *qs, int msg, int key, int altkey, const char *desc); int msgId() const {return msgCmd;} void bindKey(int key,int &qk,int &scik); QsciScintilla *qsCmd; int msgCmd; int qkey, scikey, qaltkey, scialtkey; const char *descCmd; QsciCommand(const QsciCommand &); QsciCommand &operator=(const QsciCommand &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qsciprinter.h0000644000175000001440000000732611407213302023427 0ustar subzerousers// This module defines interface to the QsciPrinter class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCIPRINTER_H #define QSCIPRINTER_H extern "C++" { #include #include #include class QRect; class QPainter; class QsciScintillaBase; //! \brief The QsciPrinter class is a sub-class of the Qt QPrinter class that //! is able to print the text of a Scintilla document. //! //! The class can be further sub-classed to alter to layout of the text, adding //! headers and footers for example. class QSCINTILLA_EXPORT QsciPrinter : public QPrinter { public: //! Constructs a printer paint device with mode \a mode. QsciPrinter(PrinterMode mode = ScreenResolution); //! Destroys the QsciPrinter instance. virtual ~QsciPrinter(); //! Format a page, by adding headers and footers for example, before the //! document text is drawn on it. \a painter is the painter to be used to //! add customised text and graphics. \a drawing is true if the page is //! actually being drawn rather than being sized. \a painter drawing //! methods must only be called when \a drawing is true. \a area is the //! area of the page that will be used to draw the text. This should be //! modified if it is necessary to reserve space for any customised text or //! graphics. By default the area is relative to the printable area of the //! page. Use QPrinter::setFullPage() because calling printRange() if you //! want to try and print over the whole page. \a pagenr is the number of //! the page. The first page is numbered 1. virtual void formatPage(QPainter &painter, bool drawing, QRect &area, int pagenr); //! Return the number of points to add to each font when printing. //! //! \sa setMagnification() int magnification() const {return mag;} //! Sets the number of points to add to each font when printing to \a //! magnification. //! //! \sa magnification() virtual void setMagnification(int magnification); //! Print a range of lines from the Scintilla instance \a qsb. \a from is //! the first line to print and a negative value signifies the first line //! of text. \a to is the last line to print and a negative value //! signifies the last line of text. true is returned if there was no //! error. virtual int printRange(QsciScintillaBase *qsb, int from = -1, int to = -1); //! Return the line wrap mode used when printing. The default is //! QsciScintilla::WrapWord. //! //! \sa setWrapMode() QsciScintilla::WrapMode wrapMode() const {return wrap;} //! Sets the line wrap mode used when printing to \a wmode. //! //! \sa wrapMode() virtual void setWrapMode(QsciScintilla::WrapMode wmode); private: int mag; QsciScintilla::WrapMode wrap; QsciPrinter(const QsciPrinter &); QsciPrinter &operator=(const QsciPrinter &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexercss.h0000644000175000001440000001262111407213302023566 0ustar subzerousers// This defines the interface to the QsciLexerCSS class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERCSS_H #define QSCILEXERCSS_H extern "C++" { #include #include #include //! \brief The QsciLexerCSS class encapsulates the Scintilla CSS lexer. class QSCINTILLA_EXPORT QsciLexerCSS : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! CSS lexer. enum { //! The default. Default = 0, //! A tag. Tag = 1, //! A class selector. ClassSelector = 2, //! A pseudo-class. PseudoClass = 3, //! An pseudo-class. UnknownPseudoClass = 4, //! An operator. Operator = 5, //! A CSS1 property. CSS1Property = 6, //! An unknown property. UnknownProperty = 7, //! A value. Value = 8, //! A comment. Comment = 9, //! An ID selector. IDSelector = 10, //! An important value. Important = 11, //! An @-rule. AtRule = 12, //! A double-quoted string. DoubleQuotedString = 13, //! A single-quoted string. SingleQuotedString = 14, //! A CSS2 property. CSS2Property = 15, //! An attribute. Attribute = 16 }; //! Construct a QsciLexerCSS with parent \a parent. \a parent is typically //! the QsciScintilla instance. QsciLexerCSS(QObject *parent = 0); //! Destroys the QsciLexerCSS instance. virtual ~QsciLexerCSS(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns a space separated list of words or characters in //! a particular style that define the end of a block for //! auto-indentation. The styles is returned via \a style. const char *blockEnd(int *style = 0) const; //! \internal Returns a space separated list of words or characters in //! a particular style that define the start of a block for //! auto-indentation. The styles is returned via \a style. const char *blockStart(int *style = 0) const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. QColor defaultColor(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. void refreshProperties(); //! Returns true if multi-line comment blocks can be folded. //! //! \sa setFoldComments() bool foldComments() const; //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; public slots: //! If \a fold is true then multi-line comment blocks can be folded. //! The default is false. //! //! \sa foldComments() virtual void setFoldComments(bool fold); //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCommentProp(); void setCompactProp(); bool fold_comments; bool fold_compact; QsciLexerCSS(const QsciLexerCSS &); QsciLexerCSS &operator=(const QsciLexerCSS &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexeridl.h0000644000175000001440000000417611407213302023554 0ustar subzerousers// This defines the interface to the QsciLexerIDL class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERIDL_H #define QSCILEXERIDL_H extern "C++" { #include #include #include //! \brief The QsciLexerIDL class encapsulates the Scintilla IDL //! lexer. class QSCINTILLA_EXPORT QsciLexerIDL : public QsciLexerCPP { Q_OBJECT public: //! Construct a QsciLexerIDL with parent \a parent. \a parent is typically //! the QsciScintilla instance. QsciLexerIDL(QObject *parent = 0); //! Destroys the QsciLexerIDL instance. virtual ~QsciLexerIDL(); //! Returns the name of the language. const char *language() const; //! Returns the foreground colour of the text for style number \a style. QColor defaultColor(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; private: QsciLexerIDL(const QsciLexerIDL &); QsciLexerIDL &operator=(const QsciLexerIDL &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexercmake.h0000644000175000001440000001123011407213302024051 0ustar subzerousers// This defines the interface to the QsciLexerCMake class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERCMAKE_H #define QSCILEXERCMAKE_H extern "C++" { #include #include #include //! \brief The QsciLexerCMake class encapsulates the Scintilla CMake lexer. class QSCINTILLA_EXPORT QsciLexerCMake : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! CMake lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A string. String = 2, //! A left quoted string. StringLeftQuote = 3, //! A right quoted string. StringRightQuote = 4, //! A function. (Defined by keyword set number 1.) Function = 5, //! A variable. (Defined by keyword set number 2.) Variable = 6, //! A label. Label = 7, //! A keyword defined in keyword set number 3. The class must be //! sub-classed and re-implement keywords() to make use of this style. KeywordSet3 = 8, //! A WHILE block. BlockWhile = 9, //! A FOREACH block. BlockForeach = 10, //! An IF block. BlockIf = 11, //! A MACRO block. BlockMacro = 12, //! A variable within a string. StringVariable = 13, //! A number. Number = 14 }; //! Construct a QsciLexerCMake with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerCMake(QObject *parent = 0); //! Destroys the QsciLexerCMake instance. virtual ~QsciLexerCMake(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the propertyChanged() //! signal as required. void refreshProperties(); //! Returns true if ELSE blocks can be folded. //! //! \sa setFoldAtElse() bool foldAtElse() const; public slots: //! If \a fold is true then ELSE blocks can be folded. The default is //! false. //! //! \sa foldAtElse() virtual void setFoldAtElse(bool fold); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setAtElseProp(); bool fold_atelse; QsciLexerCMake(const QsciLexerCMake &); QsciLexerCMake &operator=(const QsciLexerCMake &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerpov.h0000644000175000001440000001410611407213302023602 0ustar subzerousers// This defines the interface to the QsciLexerPOV class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERPOV_H #define QSCILEXERPOV_H extern "C++" { #include #include #include //! \brief The QsciLexerPOV class encapsulates the Scintilla POV lexer. class QSCINTILLA_EXPORT QsciLexerPOV : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! POV lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A comment line. CommentLine = 2, //! A number. Number = 3, //! An operator. Operator = 4, //! An identifier Identifier = 5, //! A string. String = 6, //! The end of a line where a string is not closed. UnclosedString = 7, //! A directive. Directive = 8, //! A bad directive. BadDirective = 9, //! Objects, CSG and appearance. ObjectsCSGAppearance = 10, //! Types, modifiers and items. TypesModifiersItems = 11, //! Predefined identifiers. PredefinedIdentifiers = 12, //! Predefined identifiers. PredefinedFunctions = 13, //! A keyword defined in keyword set number 6. The class must be //! sub-classed and re-implement keywords() to make use of this style. KeywordSet6 = 14, //! A keyword defined in keyword set number 7. The class must be //! sub-classed and re-implement keywords() to make use of this style. KeywordSet7 = 15, //! A keyword defined in keyword set number 8. The class must be //! sub-classed and re-implement keywords() to make use of this style. KeywordSet8 = 16 }; //! Construct a QsciLexerPOV with parent \a parent. \a parent is typically //! the QsciScintilla instance. QsciLexerPOV(QObject *parent = 0); //! Destroys the QsciLexerPOV instance. virtual ~QsciLexerPOV(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the propertyChanged() //! signal as required. void refreshProperties(); //! Returns true if multi-line comment blocks can be folded. //! //! \sa setFoldComments() bool foldComments() const; //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; //! Returns true if directives can be folded. //! //! \sa setFoldDirectives() bool foldDirectives() const; public slots: //! If \a fold is true then multi-line comment blocks can be folded. //! The default is false. //! //! \sa foldComments() virtual void setFoldComments(bool fold); //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); //! If \a fold is true then directives can be folded. The default is //! false. //! //! \sa foldDirectives() virtual void setFoldDirectives(bool fold); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCommentProp(); void setCompactProp(); void setDirectiveProp(); bool fold_comments; bool fold_compact; bool fold_directives; QsciLexerPOV(const QsciLexerPOV &); QsciLexerPOV &operator=(const QsciLexerPOV &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscidocument.h0000644000175000001440000000347711407213302023565 0ustar subzerousers// This defines the interface to the QsciDocument class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCIDOCUMENT_H #define QSCIDOCUMENT_H extern "C++" { #include class QsciScintillaBase; class QsciDocumentP; //! \brief The QsciDocument class represents a document to be edited. //! //! It is an opaque class that can be attached to multiple instances of //! QsciScintilla to create different simultaneous views of the same document. //! QsciDocument uses implicit sharing so that copying class instances is a //! cheap operation. class QSCINTILLA_EXPORT QsciDocument { public: //! Create a new unattached document. QsciDocument(); virtual ~QsciDocument(); QsciDocument(const QsciDocument &); QsciDocument &operator=(const QsciDocument &); private: friend class QsciScintilla; void attach(const QsciDocument &that); void detach(); void display(QsciScintillaBase *qsb, const QsciDocument *from); void undisplay(QsciScintillaBase *qsb); QsciDocumentP *pdoc; }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qsciglobal.h0000644000175000001440000000310411407213302023172 0ustar subzerousers// This module defines various things common to all of the Scintilla Qt port. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCIGLOBAL_H #define QSCIGLOBAL_H extern "C++" { #include #define QSCINTILLA_VERSION 0x020100 #define QSCINTILLA_VERSION_STR "2-snapshot-20070916" // Under Windows, define QSCINTILLA_MAKE_DLL to create a Scintilla DLL, or // define QSCINTILLA_DLL to link against a Scintilla DLL, or define neither // to either build or link against a static Scintilla library. #if defined(Q_WS_WIN) #if defined(QSCINTILLA_DLL) #define QSCINTILLA_EXPORT __declspec(dllimport) #elif defined(QSCINTILLA_MAKE_DLL) #define QSCINTILLA_EXPORT __declspec(dllexport) #endif #endif #if !defined(QSCINTILLA_EXPORT) #define QSCINTILLA_EXPORT #endif } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexersql.h0000644000175000001440000001443311407213302023600 0ustar subzerousers// This defines the interface to the QsciLexerSQL class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERSQL_H #define QSCILEXERSQL_H extern "C++" { #include #include #include //! \brief The QsciLexerSQL class encapsulates the Scintilla SQL lexer. class QSCINTILLA_EXPORT QsciLexerSQL : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! SQL lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A line comment. CommentLine = 2, //! A JavaDoc/Doxygen style comment. CommentDoc = 3, //! A number. Number = 4, //! A keyword. Keyword = 5, //! A double-quoted string. DoubleQuotedString = 6, //! A single-quoted string. SingleQuotedString = 7, //! An SQL*Plus keyword. PlusKeyword = 8, //! An SQL*Plus prompt. PlusPrompt = 9, //! An operator. Operator = 10, //! An identifier Identifier = 11, //! An SQL*Plus comment. PlusComment = 13, //! A '#' line comment. CommentLineHash = 15, //! A JavaDoc/Doxygen keyword. CommentDocKeyword = 17, //! A JavaDoc/Doxygen keyword error. CommentDocKeywordError = 18, //! A keyword defined in keyword set number 5. The class must be //! sub-classed and re-implement keywords() to make use of this style. KeywordSet5 = 19, //! A keyword defined in keyword set number 6. The class must be //! sub-classed and re-implement keywords() to make use of this style. KeywordSet6 = 20, //! A keyword defined in keyword set number 7. The class must be //! sub-classed and re-implement keywords() to make use of this style. KeywordSet7 = 21, //! A keyword defined in keyword set number 8. The class must be //! sub-classed and re-implement keywords() to make use of this style. KeywordSet8 = 22 }; //! Construct a QsciLexerSQL with parent \a parent. \a parent is typically //! the QsciScintilla instance. QsciLexerSQL(QObject *parent = 0); //! Destroys the QsciLexerSQL instance. virtual ~QsciLexerSQL(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. void refreshProperties(); //! Returns true if multi-line comment blocks can be folded. //! //! \sa setFoldComments() bool foldComments() const; //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; //! Returns true if backslash escapes are enabled. //! //! \sa setBackslashEscapes() bool backslashEscapes() const; public slots: //! If \a fold is true then multi-line comment blocks can be folded. //! The default is false. //! //! \sa foldComments() virtual void setFoldComments(bool fold); //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); //! If \a enable is true then backslash escapes are enabled. The //! default is false. //! //! \sa backslashEscapes() virtual void setBackslashEscapes(bool enable); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCommentProp(); void setCompactProp(); void setBackslashEscapesProp(); bool fold_comments; bool fold_compact; bool backslash_escapes; QsciLexerSQL(const QsciLexerSQL &); QsciLexerSQL &operator=(const QsciLexerSQL &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexermakefile.h0000644000175000001440000000612111407213302024551 0ustar subzerousers// This defines the interface to the QsciLexerMakefile class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERMAKEFILE_H #define QSCILEXERMAKEFILE_H extern "C++" { #include #include #include //! \brief The QsciLexerMakefile class encapsulates the Scintilla //! Makefile lexer. class QSCINTILLA_EXPORT QsciLexerMakefile : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! Makefile lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A pre-processor directive. Preprocessor = 2, //! A variable. Variable = 3, //! An operator. Operator = 4, //! A target. Target = 5, //! An error. Error = 9 }; //! Construct a QsciLexerMakefile with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerMakefile(QObject *parent = 0); //! Destroys the QsciLexerMakefile instance. virtual ~QsciLexerMakefile(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; private: QsciLexerMakefile(const QsciLexerMakefile &); QsciLexerMakefile &operator=(const QsciLexerMakefile &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qsciapis.h0000644000175000001440000002076211407213302022677 0ustar subzerousers// This module defines interface to the QsciAPIs class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCIAPIS_H #define QSCIAPIS_H extern "C++" { #include #include #include #include #include #include class QsciAPIsPrepared; class QsciAPIsWorker; class QsciLexer; //! \brief The QsciAPIs class represents the textual API information used in //! call tips and for auto-completion. API information is specific to a //! particular language lexer but can be shared by multiple instances of the //! lexer. //! //! Raw API information is read from one or more files. Each API function is //! described by a single line of text comprising the function's name, followed //! by the function's optional comma separated parameters enclosed in //! parenthesis, and finally followed by optional explanatory text. //! //! A function name may be followed by a `?' and a number. The number is used //! by auto-completion to display a registered QPixmap with the function name. //! //! All function names are used by auto-completion, but only those that include //! function parameters are used in call tips. //! //! QScintilla only deals with prepared API information and not the raw //! information described above. This is done so that large APIs can be //! handled while still being responsive to user input. The conversion of raw //! information to prepared information is time consuming (think tens of //! seconds) and implemented in a separate thread. Processed information can //! be quickly saved to and loaded from files. Such files are portable between //! different architectures. //! //! QScintilla based applications that want to support large APIs would //! normally provide the user with the ability to specify a set of, possibly //! project specific, raw API files and convert them to prepared files that are //! loaded quickly when the application is invoked. class QSCINTILLA_EXPORT QsciAPIs : public QObject { Q_OBJECT public: //! Constructs a QsciAPIs instance attached to lexer \a lexer. \a lexer //! becomes the instance's parent object although the instance can also be //! subsequently attached to other lexers. QsciAPIs(QsciLexer *lexer); //! Destroy the QsciAPIs instance. virtual ~QsciAPIs(); //! Add the single raw API entry \a entry to the current set. //! //! \sa clear(), load(), remove() void add(const QString &entry); //! Deletes all raw API information. //! //! \sa add(), load(), remove() void clear(); //! Load the API information from the file named \a fname, adding it to the //! current set. Returns true if successful, otherwise false. bool load(const QString &fname); //! Remove the single raw API entry \a entry from the current set. //! //! \sa add(), clear(), load() void remove(const QString &entry); //! Convert the current raw API information to prepared API information. //! This is implemented by a separate thread. //! //! \sa cancelPreparation() void prepare(); //! Cancel the conversion of the current raw API information to prepared //! API information. //! //! \sa prepare() void cancelPreparation(); //! Return the default name of the prepared API information file. It is //! based on the name of the associated lexer and in the directory defined //! by the QSCIDIR environment variable. If the environment variable isn't //! set then $HOME/.qsci is used. QString defaultPreparedName() const; //! Check to see is a prepared API information file named \a fname exists. //! If \a fname is empty then the value returned by defaultPreparedName() //! is used. Returns true if successful, otherwise false. //! //! \sa defaultPreparedName() bool isPrepared(const QString &fname = QString()) const; //! Load the prepared API information from the file named \a fname. If //! \a fname is empty then a name is constructed based on the name of the //! associated lexer and saved in the directory defined by the QSCIDIR //! environment variable. If the environment variable isn't set then //! $HOME/.qsci is used. Returns true if successful, otherwise false. bool loadPrepared(const QString &fname = QString()); //! Save the prepared API information to the file named \a fname. If //! \a fname is empty then a name is constructed based on the name of the //! associated lexer and saved in the directory defined by the QSCIDIR //! environment variable. If the environment variable isn't set then //! $HOME/.qsci is used. Returns true if successful, otherwise false. bool savePrepared(const QString &fname = QString()) const; //! \internal Updates an auto-completion list with API entries based on the //! context from the user. void autoCompletionList(const QStringList &context, QStringList &wlist); //! \internal Handle the selection of an entry in the auto-completion list. void autoCompletionSelected(const QString &sel); //! \internal Return the call tips valid for the given context. QString callTips(const QStringList &context, QsciScintilla::CallTipsStyle style, int maxnr, int commas, int &ctshift); //! \internal QString callTipsNextPrev(int dir, int &ctshift); //! \internal Reimplemented to receive termination events from the worker //! thread. virtual bool event(QEvent *e); //! Return a list of the installed raw API file names for the associated //! lexer. QStringList installedAPIFiles() const; signals: //! This signal is emitted when the conversion of raw API information to //! prepared API information has been cancelled. //! //! \sa apiPreparationFinished(), apiPreparationStarted() void apiPreparationCancelled(); //! This signal is emitted when the conversion of raw API information to //! prepared API information starts and can be used to give some visual //! feedback to the user. //! //! \sa apiPreparationCancelled(), apiPreparationFinished() void apiPreparationStarted(); //! This signal is emitted when the conversion of raw API information to //! prepared API information has finished. //! //! \sa apiPreparationCancelled(), apiPreparationStarted() void apiPreparationFinished(); private: friend class QsciAPIsPrepared; friend class QsciAPIsWorker; // This indexes a word in a set of raw APIs. The first part indexes the // entry in the set, the second part indexes the word within the entry. typedef QPair WordIndex; // This is a list of word indexes. typedef QList WordIndexList; const QsciLexer *lex; QsciAPIsWorker *worker; int ctcursor; QStringList old_context; QStringList::const_iterator origin; int origin_len; QString unambiguous_context; QStringList apis; QsciAPIsPrepared *prep; QStringList ctlist; QList ctshifts; static bool enoughCommas(const QString &s, int commas); QStringList positionOrigin(const QStringList &context, QString &path); bool originStartsWith(const QString &path, const QString &wsep); const WordIndexList *wordIndexOf(const QString &word) const; void lastCompleteWord(const QString &word, QStringList &with_context, bool &unambig); void lastPartialWord(const QString &word, QStringList &with_context, bool &unambig); void addAPIEntries(const WordIndexList &wl, bool complete, QStringList &with_context, bool &unambig); QString prepName(const QString &fname, bool mkpath = false) const; void deleteWorker(); QsciAPIs(const QsciAPIs &); QsciAPIs &operator=(const QsciAPIs &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerbash.h0000644000175000001440000001144511407213302023716 0ustar subzerousers// This defines the interface to the QsciLexerBash class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERBASH_H #define QSCILEXERBASH_H extern "C++" { #include #include #include //! \brief The QsciLexerBash class encapsulates the Scintilla Bash lexer. class QSCINTILLA_EXPORT QsciLexerBash : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! Bash lexer. enum { //! The default. Default = 0, //! An error. Error = 1, //! A comment. Comment = 2, //! A number. Number = 3, //! A keyword. Keyword = 4, //! A double-quoted string. DoubleQuotedString = 5, //! A single-quoted string. SingleQuotedString = 6, //! An operator. Operator = 7, //! An identifier Identifier = 8, //! A scalar. Scalar = 9, //! Parameter expansion. ParameterExpansion = 10, //! Backticks. Backticks = 11, //! A here document delimiter. HereDocumentDelimiter = 12, //! A single quoted here document. SingleQuotedHereDocument = 13 }; //! Construct a QsciLexerBash with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerBash(QObject *parent = 0); //! Destroys the QsciLexerBash instance. virtual ~QsciLexerBash(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. void refreshProperties(); //! Returns true if multi-line comment blocks can be folded. //! //! \sa setFoldComments() bool foldComments() const; //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; public slots: //! If \a fold is true then multi-line comment blocks can be folded. //! The default is false. //! //! \sa foldComments() virtual void setFoldComments(bool fold); //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCommentProp(); void setCompactProp(); bool fold_comments; bool fold_compact; QsciLexerBash(const QsciLexerBash &); QsciLexerBash &operator=(const QsciLexerBash &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexercsharp.h0000644000175000001440000000505211407213302024256 0ustar subzerousers// This defines the interface to the QsciLexerCSharp class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERCSHARP_H #define QSCILEXERCSHARP_H extern "C++" { #include #include #include //! \brief The QsciLexerCSharp class encapsulates the Scintilla C# //! lexer. class QSCINTILLA_EXPORT QsciLexerCSharp : public QsciLexerCPP { Q_OBJECT public: //! Construct a QsciLexerCSharp with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerCSharp(QObject *parent = 0); //! Destroys the QsciLexerCSharp instance. virtual ~QsciLexerCSharp(); //! Returns the name of the language. const char *language() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; private: QsciLexerCSharp(const QsciLexerCSharp &); QsciLexerCSharp &operator=(const QsciLexerCSharp &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qsciscintilla.h0000644000175000001440000015102311407213302023720 0ustar subzerousers// This module defines the "official" high-level API of the Qt port of // Scintilla. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCISCINTILLA_H #define QSCISCINTILLA_H extern "C++" { #include #include #include #include #include #include #include class QsciLexer; class QsciCommandSet; //! \brief The QsciScintilla class implements a higher level, more Qt-like, //! API to the Scintilla editor widget. //! //! QsciScintilla implements methods, signals and slots similar to those found //! in other Qt editor classes. It also provides a higher level interface to //! features specific to Scintilla such as syntax styling, call tips, //! auto-indenting and auto-completion than that provided by QsciScintillaBase. class QSCINTILLA_EXPORT QsciScintilla : public QsciScintillaBase { Q_OBJECT public: //! This enum defines the different auto-indentation styles. enum { //! A line is automatically indented to match the previous line. AiMaintain = 0x01, //! If the language supported by the current lexer has a specific start //! of block character (e.g. { in C++), then a line that begins with //! that character is indented as well as the lines that make up the //! block. It may be logically ored with AiClosing. AiOpening = 0x02, //! If the language supported by the current lexer has a specific end //! of block character (e.g. } in C++), then a line that begins with //! that character is indented as well as the lines that make up the //! block. It may be logically ored with AiOpening. AiClosing = 0x04 }; //! This enum defines the different sources for auto-completion lists. enum AutoCompletionSource { //! No sources are used, ie. automatic auto-completion is disabled. AcsNone, //! The source is all available sources. AcsAll, //! The source is the current document. AcsDocument, //! The source is any installed APIs. AcsAPIs }; //! This enum defines the different brace matching modes. The character //! pairs {}, [] and () are treated as braces. The Python lexer will also //! match a : with the end of the corresponding indented block. enum BraceMatch { //! Brace matching is disabled. NoBraceMatch, //! Brace matching is enabled for a brace immediately before the //! current position. StrictBraceMatch, //! Brace matching is enabled for a brace immediately before or after //! the current position. SloppyBraceMatch }; //! This enum defines the different call tip styles. enum CallTipsStyle { //! Call tips are disabled. CallTipsNone, //! Call tips are displayed without a context. A context is any scope //! (e.g. a C++ namespace or a Python module) prior to the function //! name. CallTipsNoContext, //! Call tips are displayed with a context only if the user hasn't //! already implicitly identified the context using autocompletion. //! Note that this style may not always be able to align the call tip //! with the text being entered. CallTipsNoAutoCompletionContext, //! Call tips are displayed with a context. Note that this style //! may not always be able to align the call tip with the text being //! entered. CallTipsContext }; //! This enum defines the different edge modes for long lines. enum EdgeMode { //! Long lines are not marked. EdgeNone = EDGE_NONE, //! A vertical line is drawn at the column set by setEdgeColumn(). //! This is recommended for monospace fonts. EdgeLine = EDGE_LINE, //! The background color of characters after the column limit is //! changed to the color set by setEdgeColor(). This is recommended //! for proportional fonts. EdgeBackground = EDGE_BACKGROUND }; //! This enum defines the different end-of-line modes. enum EolMode { //! A carriage return/line feed as used on Windows systems. EolWindows = SC_EOL_CRLF, //! A line feed as used on Unix systems. EolUnix = SC_EOL_LF, //! A carriage return as used on Mac systems. EolMac = SC_EOL_CR }; //! This enum defines the different styles for the folding margin. enum FoldStyle { //! Folding is disabled. NoFoldStyle, //! Plain folding style using plus and minus symbols. PlainFoldStyle, //! Circled folding style using circled plus and minus symbols. CircledFoldStyle, //! Boxed folding style using boxed plus and minus symbols. BoxedFoldStyle, //! Circled tree style using a flattened tree with circled plus and //! minus symbols and rounded corners. CircledTreeFoldStyle, //! Boxed tree style using a flattened tree with boxed plus and minus //! symbols and right-angled corners. BoxedTreeFoldStyle }; //! This enum defines the different pre-defined marker symbols. enum MarkerSymbol { //! A circle. Circle = SC_MARK_CIRCLE, //! A rectangle. Rectangle = SC_MARK_ROUNDRECT, //! A triangle pointing to the right. RightTriangle = SC_MARK_ARROW, //! A smaller rectangle. SmallRectangle = SC_MARK_SMALLRECT, //! An arrow pointing to the right. RightArrow = SC_MARK_SHORTARROW, //! An invisible marker that allows code to track the movement //! of lines. Invisible = SC_MARK_EMPTY, //! A triangle pointing down. DownTriangle = SC_MARK_ARROWDOWN, //! A drawn minus sign. Minus = SC_MARK_MINUS, //! A drawn plus sign. Plus = SC_MARK_PLUS, //! A vertical line drawn in the background colour. VerticalLine = SC_MARK_VLINE, //! A bottom left corner drawn in the background colour. BottomLeftCorner = SC_MARK_LCORNER, //! A vertical line with a centre right horizontal line drawn //! in the background colour. LeftSideSplitter = SC_MARK_TCORNER, //! A drawn plus sign in a box. BoxedPlus = SC_MARK_BOXPLUS, //! A drawn plus sign in a connected box. BoxedPlusConnected = SC_MARK_BOXPLUSCONNECTED, //! A drawn minus sign in a box. BoxedMinus = SC_MARK_BOXMINUS, //! A drawn minus sign in a connected box. BoxedMinusConnected = SC_MARK_BOXMINUSCONNECTED, //! A rounded bottom left corner drawn in the background //! colour. RoundedBottomLeftCorner = SC_MARK_LCORNERCURVE, //! A vertical line with a centre right curved line drawn in the //! background colour. LeftSideRoundedSplitter = SC_MARK_TCORNERCURVE, //! A drawn plus sign in a circle. CircledPlus = SC_MARK_CIRCLEPLUS, //! A drawn plus sign in a connected box. CircledPlusConnected = SC_MARK_CIRCLEPLUSCONNECTED, //! A drawn minus sign in a circle. CircledMinus = SC_MARK_CIRCLEMINUS, //! A drawn minus sign in a connected circle. CircledMinusConnected = SC_MARK_CIRCLEMINUSCONNECTED, //! No symbol is drawn but the line of text is drawn with the same //! background colour. Background = SC_MARK_BACKGROUND, //! Three drawn dots. ThreeDots = SC_MARK_DOTDOTDOT, //! Three drawn arrows pointing right. ThreeRightArrows = SC_MARK_ARROWS }; //! This enum defines the different whitespace visibility modes. When //! whitespace is visible spaces are displayed as small centred dots and //! tabs are displayed as light arrows pointing to the right. enum WhitespaceVisibility { //! Whitespace is invisible. WsInvisible = SCWS_INVISIBLE, //! Whitespace is always visible. WsVisible = SCWS_VISIBLEALWAYS, //! Whitespace is visible after the whitespace used for indentation. WsVisibleAfterIndent = SCWS_VISIBLEAFTERINDENT }; //! This enum defines the different line wrap modes. enum WrapMode { //! Lines are not wrapped. WrapNone = SC_WRAP_NONE, //! Lines are wrapped at word boundaries. WrapWord = SC_WRAP_WORD, //! Lines are wrapped at character boundaries. WrapCharacter = SC_WRAP_CHAR }; //! This enum defines the different line wrap visual flags. enum WrapVisualFlag { //! No wrap flag is displayed. WrapFlagNone, //! A wrap flag is displayed by the text. WrapFlagByText, //! A wrap flag is displayed by the border. WrapFlagByBorder }; //! Construct an empty QsciScintilla with parent \a parent. QsciScintilla(QWidget *parent = 0); //! Destroys the QsciScintilla instance. virtual ~QsciScintilla(); //! Returns true if auto-completion lists are case sensitive. //! //! \sa setAutoCompletionCaseSensitivity() bool autoCompletionCaseSensitivity() const; //! Returns true if auto-completion fill-up characters are enabled. //! //! \sa setAutoCompletionFillups(), setAutoCompletionFillupsEnabled() bool autoCompletionFillupsEnabled() const; //! Returns true if the rest of the word to the right of the current cursor //! is removed when an item from an auto-completion list is selected. //! //! \sa setAutoCompletionReplaceWord() bool autoCompletionReplaceWord() const; //! Returns true if the only item in an auto-completion list with a single //! entry is automatically used and the list not displayed. //! //! \sa setAutoCompletionShowSingle() bool autoCompletionShowSingle() const; //! Returns the current source for the auto-completion list when it is //! being displayed automatically as the user types. //! //! \sa setAutoCompletionSource() AutoCompletionSource autoCompletionSource() const {return acSource;} //! Returns the current threshold for the automatic display of the //! auto-completion list as the user types. //! //! \sa setAutoCompletionThreshold() int autoCompletionThreshold() const {return acThresh;} //! Returns true if auto-indentation is enabled. //! //! \sa setAutoIndent() bool autoIndent() const {return autoInd;} //! Returns true if the backspace key unindents a line instead of deleting //! a character. The default is false. //! //! \sa setBackspaceUnindents(), tabIndents(), setTabIndents() bool backspaceUnindents() const; //! Mark the beginning of a sequence of actions that can be undone by a //! single call to undo(). //! //! \sa endUndoAction(), undo() void beginUndoAction(); //! Returns the brace matching mode. //! //! \sa setBraceMatching() BraceMatch braceMatching() const {return braceMode;} //! Returns the current call tip style. //! //! \sa setCallTipsStyle() CallTipsStyle callTipsStyle() const {return call_tips_style;} //! Returns the maximum number of call tips that are displayed. //! //! \sa setCallTipsVisible() int callTipsVisible() const {return maxCallTips;} //! Cancel any current auto-completion or user defined list. void cancelList(); //! Returns true if the current language lexer is case sensitive. If there //! is no current lexer then true is returned. bool caseSensitive() const; //! Clear all registered images. //! //! \sa registerImage() void clearRegisteredImages(); //! Returns the widget's text (ie. foreground) colour. //! //! \sa setColor() QColor color() const; //! All the lines of the text have their end-of-lines converted to mode //! \a mode. //! //! \sa eolMode(), setEolMode() void convertEols(EolMode mode); //! Returns the attached document. //! //! \sa setDocument() QsciDocument document() const {return doc;} //! Mark the end of a sequence of actions that can be undone by a single //! call to undo(). //! //! \sa beginUndoAction(), undo() void endUndoAction(); //! Returns the color of the marker used to show that a line has exceeded //! the length set by setEdgeColumn(). //! //! \sa setEdgeColor(), \sa setEdgeColumn QColor edgeColor() const; //! Returns the number of the column after which lines are considered to be //! long. //! //! \sa setEdgeColumn() int edgeColumn() const; //! Returns the edge mode which determines how long lines are marked. //! //! \sa setEdgeMode() EdgeMode edgeMode() const; //! Set the default font. This has no effect if a language lexer has been //! set. void setFont(const QFont &f); //! Returns the end-of-line mode. //! //! \sa setEolMode() EolMode eolMode() const; //! Returns the visibility of end-of-lines. //! //! \sa setEolVisibility() bool eolVisibility() const; //! Find the next occurrence of the string \a expr and return true if //! \a expr was found, otherwise returns false. If \a expr is found it //! becomes the current selection. //! //! If \a re is true then \a expr is interpreted as a regular expression //! rather than a simple string. //! //! If \a cs is true then the search is case sensitive. //! //! If \a wo is true then the search looks for whole word matches only, //! otherwise it searches for any matching text. //! //! If \a wrap is true then the search wraps around the end of the text. //! //! If \a forward is true (the default) then the search is forward from the //! starting position to the end of the text, otherwise it is backwards to //! the beginning of the text. //! //! If either \a line or \a index are negative (the default) then the //! search begins from the current cursor position. Otherwise the search //! begins at position \a index of line \a line. //! //! If \a show is true (the default) then any text found is made visible //! (ie. it is unfolded). //! //! \sa findNext(), replace() virtual bool findFirst(const QString &expr, bool re, bool cs, bool wo, bool wrap, bool forward = true, int line = -1, int index = -1, bool show = true); //! Find the next occurence of the string found using findFirst(). //! //! \sa findFirst(), replace() virtual bool findNext(); //! Returns the number of the first visible line. int firstVisibleLine() const; //! Returns the current folding style. //! //! \sa setFolding() FoldStyle folding() const {return fold;} //! Sets \a *line and \a *index to the line and index of the cursor. //! //! \sa setCursorPosition() void getCursorPosition(int *line, int *index) const; //! If there is a selection, \a *lineFrom is set to the line number in //! which the selection begins and \a *lineTo is set to the line number in //! which the selection ends. (They could be the same.) \a *indexFrom is //! set to the index at which the selection begins within \a *lineFrom, and //! \a *indexTo is set to the index at which the selection ends within //! \a *lineTo. If there is no selection, \a *lineFrom, \a *indexFrom, //! \a *lineTo and \a *indexTo are all set to -1. //! //! \sa setSelection() void getSelection(int *lineFrom, int *indexFrom, int *lineTo, int *indexTo) const; //! Returns true if some text is selected. //! //! \sa selectedText() bool hasSelectedText() const {return selText;} //! Returns the number of characters that line \a line is indented by. //! //! \sa setIndentation() int indentation(int line) const; //! Returns true if the display of indentation guides is enabled. //! //! \sa setIndentationGuides() bool indentationGuides() const; //! Returns true if indentations are created using tabs and spaces, rather //! than just spaces. The default is true. //! //! \sa setIndentationsUseTabs() bool indentationsUseTabs() const; //! Returns the indentation width in characters. The default is 0 which //! means that the value returned by tabWidth() is actually used. //! //! \sa setIndentationWidth(), tabWidth() int indentationWidth() const; //! Returns true if a call tip is currently active. bool isCallTipActive() const; //! Returns true if an auto-completion or user defined list is currently //! active. bool isListActive() const; //! Returns true if the text has been modified. //! //! \sa setModified(), modificationChanged() bool isModified() const; //! Returns true if the text edit is read-only. //! //! \sa setReadOnly() bool isReadOnly() const; //! Returns true if there is something that can be redone. //! //! \sa redo() bool isRedoAvailable() const; //! Returns true if there is something that can be undone. //! //! \sa undo() bool isUndoAvailable() const; //! Returns true if text is interpreted as being UTF8 encoded. The default //! is to interpret the text as Latin1 encoded. //! //! \sa setUtf8() bool isUtf8() const; //! Returns true if character \a ch is a valid word character. //! //! \sa wordCharacters() bool isWordCharacter(char ch) const; //! Returns the line which is at position \a pos or -1 if there is no line //! at that position. int lineAt(const QPoint &pos) const; //! Returns the length of line \a line or -1 if there is no such line. int lineLength(int line) const; //! Returns the number of lines of text. int lines() const; //! Returns the length of the text edit's text. int length() const; //! Returns the current language lexer used to style text. If it is 0 then //! syntax styling is disabled. //! //! \sa setLexer() QsciLexer *lexer() const; //! Returns true if line numbers are enabled for margin \a margin. //! //! \sa setMarginLineNumbers(), SCI_GETMARGINTYPEN bool marginLineNumbers(int margin) const; //! Returns the marker mask of margin \a margin. //! //! \sa setMarginMask(), QsciMarker, SCI_GETMARGINMASKN int marginMarkerMask(int margin) const; //! Returns true if margin \a margin is sensitive to mouse clicks. //! //! \sa setMarginSensitivity(), marginClicked(), SCI_GETMARGINTYPEN bool marginSensitivity(int margin) const; //! Returns the width in pixels of margin \a margin. //! //! \sa setMarginWidth(), SCI_GETMARGINWIDTHN int marginWidth(int margin) const; //! Define a marker using the symbol \a sym with the marker number \a mnr. //! If \a mnr is -1 then the marker number is automatically allocated. The //! marker number is returned or -1 if the marker number was already //! allocated or too many markers have been defined. //! //! Markers are small geometric symbols and character used, for example, to //! indicate the current line or, in debuggers, to indicate breakpoints. //! If a margin has a width of 0 then its markers are not drawn, but their //! background colours affect the background colour of the corresponding //! line of text. //! //! There may be up to 32 markers defined and each line of text has a set //! of these markers associated with it. Markers are drawn according to //! their numerical identifier. Markers try to move with their text by //! tracking where the start of their line moves to. For example, when a //! line is deleted its markers are added to previous line's markers. //! //! Each marker is identified by a marker number. Each instance of a //! marker is identified by a marker handle. int markerDefine(MarkerSymbol sym, int mnr = -1); //! Define a marker using the character \a ch with the marker number //! \a mnr. If \a mnr is -1 then the marker number is automatically //! allocated. The marker number is returned or -1 if the marker number //! was already allocated or too many markers have been defined. int markerDefine(char ch, int mnr = -1); //! Define a marker using a copy of the pixmap \a pm with the marker number //! \a mnr. If \a mnr is -1 then the marker number is automatically //! allocated. The marker number is returned or -1 if the marker number //! was already allocated or too many markers have been defined. int markerDefine(const QPixmap &pm, int mnr = -1); //! Add a marker number \a mnr to line number \a linenr. A handle for the //! marker is returned which can be used to track the marker's position, or //! -1 if the \a mnr was invalid. //! //! \sa markerDelete(), markerDeleteAll(), markerDeleteHandle() int markerAdd(int linenr, int mnr); //! Returns the 32 bit mask of marker numbers at line number \a linenr. //! //! \sa markerAdd() unsigned markersAtLine(int linenr) const; //! Delete all markers with the marker number \a mnr in the line \a linenr. //! If \a mnr is -1 then delete all markers from line \a linenr. //! //! \sa markerAdd(), markerDeleteAll(), markerDeleteHandle() void markerDelete(int linenr, int mnr = -1); //! Delete the all markers with the marker number \a mnr. If \a mnr is -1 //! then delete all markers. //! //! \sa markerAdd(), markerDelete(), markerDeleteHandle() void markerDeleteAll(int mnr = -1); //! Delete the the marker instance with the marker handle \a mhandle. //! //! \sa markerAdd(), markerDelete(), markerDeleteAll() void markerDeleteHandle(int mhandle); //! Return the line number that contains the marker instance with the //! marker handle \a mhandle. int markerLine(int mhandle) const; //! Return the number of the next line to contain at least one marker from //! a 32 bit mask of markers. \a linenr is the line number to start the //! search from. \a mask is the mask of markers to search for. //! //! \sa markerFindPrevious() int markerFindNext(int linenr, unsigned mask) const; //! Return the number of the previous line to contain at least one marker //! from a 32 bit mask of markers. \a linenr is the line number to start //! the search from. \a mask is the mask of markers to search for. //! //! \sa markerFindNext() int markerFindPrevious(int linenr, unsigned mask) const; //! Returns the widget's paper (ie. background) colour. //! //! \sa setPaper() QColor paper() const; //! Recolours the document between the \a start and \a end positions. //! \a start defaults to the start of the document and \a end defaults to //! the end of the document. virtual void recolor(int start = 0, int end = -1); //! Register an image \a pm with ID \a id. Registered images can be //! displayed in auto-completion lists. //! //! \sa clearRegisteredImages(), QsciLexer::apiLoad() void registerImage(int id, const QPixmap &pm); //! Replace the current selection, set by a previous call to findFirst() or //! findNext(), with \a replaceStr. //! //! \sa findFirst(), findNext() virtual void replace(const QString &replaceStr); //! Reset the fold margin colours to their defaults. //! //! \sa setFoldMarginColors() void resetFoldMarginColors(); //! The fold margin may be drawn as a one pixel sized checkerboard pattern //! of two colours, \a fore and \a back. //! //! \sa resetFoldMarginColors() void setFoldMarginColors(const QColor &fore, const QColor &back); //! Enable the use of fill-up characters, either those explicitly set or //! those set by a lexer. By default, fill-up characters are disabled. //! //! \sa autoCompletionFillupsEnabled(), setAutoCompletionFillups() void setAutoCompletionFillupsEnabled(bool enabled); //! A fill-up character is one that, when entered while an auto-completion //! list is being displayed, causes the currently selected item from the //! list to be added to the text followed by the fill-up character. //! \a fillups is the set of fill-up characters. If a language lexer has //! been set then this is ignored and the lexer defines the fill-up //! characters. The default is that no fill-up characters are set. //! //! \sa autoCompletionFillupsEnabled(), setAutoCompletionFillupsEnabled() void setAutoCompletionFillups(const char *fillups); //! A word separator is a sequence of characters that, when entered, causes //! the auto-completion list to be displayed. If a language lexer has been //! set then this is ignored and the lexer defines the word separators. //! The default is that no word separators are set. //! //! \sa setAutoCompletionThreshold() void setAutoCompletionWordSeparators(const QStringList &separators); //! Set the background colour of call tips to \a col. The default is //! white. void setCallTipsBackgroundColor(const QColor &col); //! Set the foreground colour of call tips to \a col. The default is //! mid-gray. void setCallTipsForegroundColor(const QColor &col); //! Set the highlighted colour of call tip text to \a col. The default is //! dark blue. void setCallTipsHighlightColor(const QColor &col); //! Set the current call tip style. The default is CallTipsNoContext. //! //! \sa callTipsStyle() void setCallTipsStyle(CallTipsStyle style); //! Set the maximum number of call tips that are displayed to \a nr. If //! the maximum number is 0 then all applicable call tips are displayed. //! If the maximum number is -1 then one call tip will be displayed with up //! and down arrows that allow the use to scroll through the full list. //! The default is -1. //! //! \sa callTipsVisible() void setCallTipsVisible(int nr); //! Attach the document \a document, replacing the currently attached //! document. //! //! \sa document() void setDocument(const QsciDocument &document); //! Set the color of the marker used to show that a line has exceeded the //! length set by setEdgeColumn(). //! //! \sa edgeColor(), \sa setEdgeColumn void setEdgeColor(const QColor &col); //! Set the number of the column after which lines are considered to be //! long. //! //! \sa edgeColumn() void setEdgeColumn(int colnr); //! Set the edge mode which determines how long lines are marked. //! //! \sa edgeMode() void setEdgeMode(EdgeMode mode); //! Set the background colour, including the alpha component, of marker //! \a mnr to \a col. If \a mnr is -1 then the colour of all markers is //! set. The default is white. //! //! \sa setMarkerForegroundColor() void setMarkerBackgroundColor(const QColor &col, int mnr = -1); //! Set the foreground colour of marker \a mnr to \a col. If \a mnr is -1 //! then the colour of all markers is set. The default is black. //! //! \sa setMarkerBackgroundColor() void setMarkerForegroundColor(const QColor &col, int mnr = -1); //! Set the background colour used to display matched braces to \a col. //! The default is white. //! //! \sa setMatchedBraceForegroundColor() void setMatchedBraceBackgroundColor(const QColor &col); //! Set the foreground colour used to display matched braces to \a col. //! The default is red. //! //! \sa setMatchedBraceBackgroundColor() void setMatchedBraceForegroundColor(const QColor &col); //! Set the background colour used to display unmatched braces to \a col. //! The default is white. //! //! \sa setUnmatchedBraceForegroundColor() void setUnmatchedBraceBackgroundColor(const QColor &col); //! Set the foreground colour used to display unmatched braces to \a col. //! The default is blue. //! //! \sa setUnmatchedBraceBackgroundColor() void setUnmatchedBraceForegroundColor(const QColor &col); //! Set the visual flags displayed when a line is wrapped. \a eflag //! determines if and where the flag at the end of a line is displayed. //! \a sflag determines if and where the flag at the start of a line is //! displayed. \a sindent is the number of characters a wrapped line is //! indented by. By default no visual flags are displayed. void setWrapVisualFlags(WrapVisualFlag eflag, WrapVisualFlag sflag = WrapFlagNone, int sindent = 0); //! Returns the selected text or an empty string if there is no currently //! selected text. //! //! \sa hasSelectedText() QString selectedText() const; //! Returns whether or not the selection is drawn up to the right hand //! border. //! //! \sa setSelectionToEol() bool selectionToEol() const; //! Sets whether or not the selection is drawn up to the right hand border. //! \a filled is set if the selection is drawn to the border. //! //! \sa selectionToEol() void setSelectionToEol(bool filled); //! Displays a user defined list which can be interacted with like an //! auto-completion list. \a id is an identifier for the list which is //! passed as an argument to the userListActivated() signal and must be at //! least 1. \a list is the text with which the list is populated. //! //! \sa cancelList(), isListActive(), userListActivated() void showUserList(int id, const QStringList &list); //! The standard command set is returned. QsciCommandSet *standardCommands() const {return stdCmds;} //! Returns true if the tab key indents a line instead of inserting a tab //! character. The default is true. //! //! \sa setTabIndents(), backspaceUnindents(), setBackspaceUnindents() bool tabIndents() const; //! Returns the tab width in characters. The default is 8. //! //! \sa setTabWidth() int tabWidth() const; //! Returns the text edit's text. //! //! \sa setText() QString text() const; //! \overload //! //! Returns the text of line \a line. //! //! \sa setText() QString text(int line) const; //! Returns the height in pixels of the text in line number \a linenr. int textHeight(int linenr) const; //! Returns the visibility of whitespace. //! //! \sa setWhitespaceVisibility() WhitespaceVisibility whitespaceVisibility() const; //! Returns the set of valid word character as defined by the current //! language lexer. If there is no current lexer then the set contains an //! an underscore, numbers and all upper and lower case alphabetic //! characters. //! //! \sa isWordCharacter() const char *wordCharacters() const; //! Returns the line wrap mode. //! //! \sa setWrapMode() WrapMode wrapMode() const; public slots: //! Appends the text \a text to the end of the text edit. Note that the //! undo/redo history is cleared by this function. virtual void append(const QString &text); //! Display an auto-completion list based on any installed APIs, the //! current contents of the document and the characters immediately to the //! left of the cursor. //! //! \sa autoCompleteFromAPIs(), autoCompleteFromDocument() virtual void autoCompleteFromAll(); //! Display an auto-completion list based on any installed APIs and the //! characters immediately to the left of the cursor. //! //! \sa autoCompleteFromAll(), autoCompleteFromDocument(), //! setAutoCompletionAPIs() virtual void autoCompleteFromAPIs(); //! Display an auto-completion list based on the current contents of the //! document and the characters immediately to the left of the cursor. //! //! \sa autoCompleteFromAll(), autoCompleteFromAPIs() virtual void autoCompleteFromDocument(); //! Display a call tip based on the the characters immediately to the left //! of the cursor. virtual void callTip(); //! Deletes all the text in the text edit. virtual void clear(); //! Copies any selected text to the clipboard. //! //! \sa copyAvailable(), cut(), paste() virtual void copy(); //! Copies any selected text to the clipboard and then deletes the text. //! //! \sa copy(), paste() virtual void cut(); //! Ensures that the cursor is visible. virtual void ensureCursorVisible(); //! Ensures that the line number \a line is visible. virtual void ensureLineVisible(int line); //! If any lines are currently folded then they are all unfolded. //! Otherwise all lines are folded. This has the same effect as clicking //! in the fold margin with the shift and control keys pressed. If //! \a children is not set (the default) then only the top level fold //! points are affected, otherwise the state of all fold points are //! changed. virtual void foldAll(bool children = false); //! If the line \a line is folded then it is unfolded. Otherwise it is //! folded. This has the same effect as clicking in the fold margin. virtual void foldLine(int line); //! Increases the indentation of line \a line by an indentation width. //! //! \sa unindent() virtual void indent(int line); //! Insert the text \a text at the current position. virtual void insert(const QString &text); //! Insert the text \a text in the line \a line at the position //! \a index. virtual void insertAt(const QString &text, int line, int index); //! If the cursor is either side of a brace character then move it to the //! position of the corresponding brace. virtual void moveToMatchingBrace(); //! Pastes any text from the clipboard into the text edit at the current //! cursor position. //! //! \sa copy(), cut() virtual void paste(); //! Redo the last change or sequence of changes. //! //! \sa isRedoAvailable() virtual void redo(); //! Removes any selected text. virtual void removeSelectedText(); //! Resets the background colour of selected text to the default. //! //! \sa setSelectionBackgroundColor(), resetSelectionForegroundColor() virtual void resetSelectionBackgroundColor(); //! Resets the foreground colour of selected text to the default. //! //! \sa setSelectionForegroundColor(), resetSelectionBackgroundColor() virtual void resetSelectionForegroundColor(); //! If \a select is true (the default) then all the text is selected. If //! \a select is false then any currently selected text is deselected. virtual void selectAll(bool select = true); //! If the cursor is either side of a brace character then move it to the //! position of the corresponding brace and select the text between the //! braces. virtual void selectToMatchingBrace(); //! If \a cs is true then auto-completion lists are case sensitive. The //! default is true. This is ignored when the auto-completion source is an //! installed API as the corresponding language determines the case //! sensitivity. //! //! \sa autoCompletionCaseSensitivity() virtual void setAutoCompletionCaseSensitivity(bool cs); //! If \a replace is true then when an item from an auto-completion list is //! selected, the rest of the word to the right of the current cursor is //! removed. The default is false. //! //! \sa autoCompletionReplaceWord() virtual void setAutoCompletionReplaceWord(bool replace); //! If \a single is true then when there is only a single entry in an //! auto-completion list it is automatically used and the list is not //! displayed. This only has an effect when auto-completion is explicitly //! requested (using autoCompleteFromAPIs() and autoCompleteFromDocument()) //! and has no effect when auto-completion is triggered as the user types. //! The default is false. //! //! \sa autoCompletionShowSingle() virtual void setAutoCompletionShowSingle(bool single); //! Sets the source for the auto-completion list when it is being displayed //! automatically as the user types to \a source. The default is AcsNone, //! ie. it is disabled. //! //! \sa autoCompletionSource() virtual void setAutoCompletionSource(AutoCompletionSource source); //! Sets the threshold for the automatic display of the auto-completion //! list as the user types to \a thresh. The threshold is the number of //! characters that the user must type before the list is displayed. If //! the threshold is less than or equal to 0 then the list is disabled. //! The default is -1. //! //! \sa autoCompletionThreshold(), setAutoCompletionWordSeparators() virtual void setAutoCompletionThreshold(int thresh); //! If \a autoindent is true then auto-indentation is enabled. The default //! is false. //! //! \sa autoIndent() virtual void setAutoIndent(bool autoindent); //! Sets the brace matching mode to \a bm. The default is NoBraceMatching. //! //! \sa braceMatching() virtual void setBraceMatching(BraceMatch bm); //! If \a deindent is true then the backspace key will unindent a line //! rather then delete a character. //! //! \sa backspaceUnindents(), tabIndents(), setTabIndents() virtual void setBackspaceUnindents(bool unindent); //! Sets the foreground colour of the caret to \a col. virtual void setCaretForegroundColor(const QColor &col); //! Sets the background colour, including the alpha component, of the line //! containing the caret to \a col. //! //! \sa setCaretLineVisible() virtual void setCaretLineBackgroundColor(const QColor &col); //! Enables or disables, according to \a enable, the background color of //! the line containing the caret. //! //! \sa setCaretLineBackgroundColor() virtual void setCaretLineVisible(bool enable); //! Sets the width of the caret to \a width pixels. A \a width of 0 makes //! the caret invisible. virtual void setCaretWidth(int width); //! The widget's text (ie. foreground) colour is set to \a c. This has no //! effect if a language lexer has been set. //! //! \sa color() virtual void setColor(const QColor &c); //! Sets the cursor to the line \a line at the position \a index. //! //! \sa getCursorPosition() virtual void setCursorPosition(int line, int index); //! Sets the end-of-line mode to \a mode. The default is the platform's //! natural mode. //! //! \sa eolMode() virtual void setEolMode(EolMode mode); //! If \a visible is true then end-of-lines are made visible. The default //! is that they are invisible. //! //! \sa eolVisibility() virtual void setEolVisibility(bool visible); //! Sets the folding style for margin 2 to \a fold. The default is //! NoFoldStyle (ie. folding is disabled). //! //! \sa folding() virtual void setFolding(FoldStyle fold); //! Sets the indentation of line \a line to \a indentation characters. //! //! \sa indentation() virtual void setIndentation(int line, int indentation); //! Enables or disables, according to \a enable, this display of //! indentation guides. //! //! \sa indentationGuides() virtual void setIndentationGuides(bool enable); //! Set the background colour of indentation guides to \a col. //! //! \sa setIndentationGuidesForegroundColor() virtual void setIndentationGuidesBackgroundColor(const QColor &col); //! Set the foreground colour of indentation guides to \a col. //! //! \sa setIndentationGuidesBackgroundColor() virtual void setIndentationGuidesForegroundColor(const QColor &col); //! If \a tabs is true then indentations are created using tabs and spaces, //! rather than just spaces. //! //! \sa indentationsUseTabs() virtual void setIndentationsUseTabs(bool tabs); //! Sets the indentation width to \a width characters. If \a width is 0 //! then the value returned by tabWidth() is used. //! //! \sa indentationWidth(), tabWidth() virtual void setIndentationWidth(int width); //! Sets the specific language lexer used to style text to \a lex. If //! \a lex is 0 then syntax styling is disabled. //! //! \sa lexer() virtual void setLexer(QsciLexer *lexer = 0); //! Set the background colour of all margins to \a col. The default is a //! gray. //! //! \sa setMarginsForegroundColor() virtual void setMarginsBackgroundColor(const QColor &col); //! Set the font used in all margins to \a f. virtual void setMarginsFont(const QFont &f); //! Set the foreground colour of all margins to \a col. The default is //! black. //! //! \sa setMarginsBackgroundColor() virtual void setMarginsForegroundColor(const QColor &col); //! Enables or disables, according to \a lnrs, the display of line numbers //! in margin \a margin. //! //! \sa marginLineNumbers(), SCI_SETMARGINTYPEN virtual void setMarginLineNumbers(int margin, bool lnrs); //! Sets the marker mask of margin \a margin to \a mask. Only those //! markers whose bit is set in the mask are displayed in the margin. //! //! \sa marginMarkerMask(), QsciMarker, SCI_SETMARGINMASKN virtual void setMarginMarkerMask(int margin, int mask); //! Enables or disables, according to \a sens, the sensitivity of margin //! \a margin to mouse clicks. If the user clicks in a sensitive margin //! the marginClicked() signal is emitted. //! //! \sa marginSensitivity(), marginClicked(), SCI_SETMARGINSENSITIVEN virtual void setMarginSensitivity(int margin, bool sens); //! Sets the width of margin \a margin to \a width pixels. If the width of //! a margin is 0 then it is not displayed. //! //! \sa marginWidth(), SCI_SETMARGINWIDTHN virtual void setMarginWidth(int margin, int width); //! Sets the width of margin \a margin so that it is wide enough to display //! \a s in the current margin font. //! //! \sa marginWidth(), SCI_SETMARGINWIDTHN virtual void setMarginWidth(int margin, const QString &s); //! Sets the modified state of the text edit to \a m. Note that it is only //! possible to clear the modified state (where \a m is false). Attempts //! to set the modified state (where \a m is true) are ignored. //! //! \sa isModified(), modificationChanged() virtual void setModified(bool m); //! The widget's paper (ie. background) colour is set to \a c. This has no //! effect if a language lexer has been set. //! //! \sa paper() virtual void setPaper(const QColor &c); //! Sets the read-only state of the text edit to \a ro. //! //! \sa isReadOnly() virtual void setReadOnly(bool ro); //! Sets the selection which starts at position \a indexFrom in line //! \a lineFrom and ends at position \a indexTo in line \a lineTo. The //! cursor is moved to the end of the selection. //! //! \sa getSelection() virtual void setSelection(int lineFrom, int indexFrom, int lineTo, int indexTo); //! Sets the background colour, including the alpha component, of selected //! text to \a col. //! //! \sa resetSelectionBackgroundColor(), setSelectionForegroundColor() virtual void setSelectionBackgroundColor(const QColor &col); //! Sets the foreground colour of selected text to \a col. //! //! \sa resetSelectionForegroundColor(), setSelectionBackgroundColor() virtual void setSelectionForegroundColor(const QColor &col); //! If \a indent is true then the tab key will indent a line rather than //! insert a tab character. //! //! \sa tabIndents(), backspaceUnindents(), setBackspaceUnindents() virtual void setTabIndents(bool indent); //! Sets the tab width to \a width characters. //! //! \sa tabWidth() virtual void setTabWidth(int width); //! Replaces all of the current text with \a text. Note that the //! undo/redo history is cleared by this function. //! //! \sa text() virtual void setText(const QString &text); //! Sets the current text encoding. If \a cp is true then UTF8 is used, //! otherwise Latin1 is used. //! //! \sa isUtf8() virtual void setUtf8(bool cp); //! Sets the visibility of whitespace to mode \a mode. The default is that //! whitespace is invisible. //! //! \sa whitespaceVisibility() virtual void setWhitespaceVisibility(WhitespaceVisibility mode); //! Sets the line wrap mode to mode \a mode. The default is that lines are //! not wrapped. //! //! \sa wrapMode() virtual void setWrapMode(WrapMode mode); //! Undo the last change or sequence of changes. //! //! Scintilla has multiple level undo and redo. It will continue to record //! undoable actions until memory runs out. Sequences of typing or //! deleting are compressed into single actions to make it easier to undo //! and redo at a sensible level of detail. Sequences of actions can be //! combined into actions that are undone as a unit. These sequences occur //! between calls to beginUndoAction() and endUndoAction(). These //! sequences can be nested and only the top level sequences are undone as //! units. //! //! \sa beginUndoAction(), endUndoAction(), isUndoAvailable() virtual void undo(); //! Decreases the indentation of line \a line by an indentation width. //! //! \sa indent() virtual void unindent(int line); //! Zooms in on the text by by making the base font size \a range points //! larger and recalculating all font sizes. //! //! \sa zoomOut(), zoomTo() virtual void zoomIn(int range); //! \overload //! //! Zooms in on the text by by making the base font size one point larger //! and recalculating all font sizes. virtual void zoomIn(); //! Zooms out on the text by by making the base font size \a range points //! smaller and recalculating all font sizes. //! //! \sa zoomIn(), zoomTo() virtual void zoomOut(int range); //! \overload //! //! Zooms out on the text by by making the base font size one point larger //! and recalculating all font sizes. virtual void zoomOut(); //! Zooms the text by making the base font size \a size points and //! recalculating all font sizes. //! //! \sa zoomIn(), zoomOut() virtual void zoomTo(int size); signals: //! This signal is emitted whenever the cursor position changes. \a line //! contains the line number and \a pos contains the character position //! within the line. void cursorPositionChanged(int line, int pos); //! This signal is emitted whenever text is selected or de-selected. //! \a yes is true if text has been selected and false if text has been //! deselected. If \a yes is true then copy() can be used to copy the //! selection to the clipboard. If \a yes is false then copy() does //! nothing. //! //! \sa copy(), selectionChanged() void copyAvailable(bool yes); //! This signal is emitted whenever the number of lines of text changes. void linesChanged(); //! This signal is emitted whenever the user clicks on a sensitive margin. //! \a margin is the margin. \a line is the number of the line where the //! user clicked. \a state is the state of the modifier keys //! (Qt::ShiftModifier, Qt::ControlModifier and Qt::AltModifer) when the //! user clicked. //! //! \sa marginSensitivity(), setMarginSensitivity() void marginClicked(int margin, int line, Qt::KeyboardModifiers state); //! This signal is emitted whenever the user attempts to modify read-only //! text. //! //! \sa isReadOnly(), setReadOnly() void modificationAttempted(); //! This signal is emitted whenever the modification state of the text //! changes. \a m is true if the text has been modified. //! //! \sa isModified(), setModified() void modificationChanged(bool m); //! This signal is emitted whenever the selection changes. //! //! \sa copyAvailable() void selectionChanged(); //! This signal is emitted whenever the text in the text edit changes. void textChanged(); //! This signal is emitted when an item in a user defined list is activated //! (selected). \a id is the list identifier. \a string is the text of //! the item. //! //! \sa showUserList() void userListActivated(int id, const QString &string); private slots: void handleCallTipClick(int dir); void handleCharAdded(int charadded); void handleMarginClick(int pos, int margin, int modifiers); void handleModified(int pos, int mtype, const char *text, int len, int added, int line, int foldNow, int foldPrev); void handlePropertyChange(const char *prop, const char *val); void handleSavePointReached(); void handleSavePointLeft(); void handleSelectionChanged(bool yes); void handleAutoCompletionSelection(); void handleUserListSelection(const char *text, int id); void handleStyleColorChange(const QColor &c, int style); void handleStyleEolFillChange(bool eolfill, int style); void handleStyleFontChange(const QFont &f, int style); void handleStylePaperChange(const QColor &c, int style); void handleUpdateUI(); private: enum IndentState { isNone, isKeywordStart, isBlockStart, isBlockEnd }; void maintainIndentation(char ch, long pos); void autoIndentation(char ch, long pos); void autoIndentLine(long pos, int line, int indent); int blockIndent(int line); IndentState getIndentState(int line); bool rangeIsWhitespace(long spos, long epos); int findStyledWord(const char *text, int style, const char *words); void checkMarker(int &mnr); long posFromLineIndex(int line, int index) const; void lineIndexFromPos(long pos, int *line, int *index) const; int currentIndent() const; int indentWidth() const; bool doFind(); int simpleFind(); void foldClick(int lineClick, int bstate); void foldChanged(int line, int levelNow, int levelPrev); void foldExpand(int &line, bool doExpand, bool force = false, int visLevels = 0, int level = -1); void setFoldMarker(int marknr, int mark = SC_MARK_EMPTY); QString convertTextS2Q(const char *s) const; void setLexerStyle(int style); void setStylesFont(const QFont &f, int style); void braceMatch(); bool findMatchingBrace(long &brace, long &other, BraceMatch mode); long checkBrace(long pos, int brace_style, bool &colonMode); void gotoMatchingBrace(bool select); void startAutoCompletion(AutoCompletionSource acs, bool checkThresh, bool single); int adjustedCallTipPosition(int ctshift) const; QStringList contextWords(int &pos, int *last_word = 0); bool getSeparator(int &pos) const; QString getWord(int &pos) const; char getCharacter(int &pos) const; bool isStartChar(char ch) const; bool ensureRW(); void insertAtPos(const QString &text, long pos); struct FindState { FindState() : inProgress(0) {} bool inProgress; QString expr; bool wrap; bool forward; int flags; long startpos; long endpos; bool show; }; FindState findState; unsigned allocatedMarkers; int oldPos; int ctPos; bool selText; FoldStyle fold; bool autoInd; BraceMatch braceMode; AutoCompletionSource acSource; int acThresh; QStringList wseps; const char *wchars; CallTipsStyle call_tips_style; int maxCallTips; bool showSingle; QPointer lex; QsciCommandSet *stdCmds; QsciDocument doc; bool modified; QColor nl_text_colour; QColor nl_paper_colour; QByteArray explicit_fillups; bool fillups_enabled; QsciScintilla(const QsciScintilla &); QsciScintilla &operator=(const QsciScintilla &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerruby.h0000644000175000001440000001230311407213302023754 0ustar subzerousers// This defines the interface to the QsciLexerRuby class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERRUBY_H #define QSCILEXERRUBY_H extern "C++" { #include #include #include //! \brief The QsciLexerRuby class encapsulates the Scintilla Ruby lexer. class QSCINTILLA_EXPORT QsciLexerRuby : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! Ruby lexer. enum { //! The default. Default = 0, //! An error. Error = 1, //! A comment. Comment = 2, //! A POD. POD = 3, //! A number. Number = 4, //! A keyword. Keyword = 5, //! A double-quoted string. DoubleQuotedString = 6, //! A single-quoted string. SingleQuotedString = 7, //! The name of a class. ClassName = 8, //! The name of a function or method. FunctionMethodName = 9, //! An operator. Operator = 10, //! An identifier Identifier = 11, //! A regular expression. Regex = 12, //! A global. Global = 13, //! A symbol. Symbol = 14, //! The name of a module. ModuleName = 15, //! An instance variable. InstanceVariable = 16, //! A class variable. ClassVariable = 17, //! Backticks. Backticks = 18, //! A data section. DataSection = 19, //! A here document delimiter. HereDocumentDelimiter = 20, //! A here document. HereDocument = 21, //! A %q string. PercentStringq = 24, //! A %Q string. PercentStringQ = 25, //! A %x string. PercentStringx = 26, //! A %r string. PercentStringr = 27, //! A %w string. PercentStringw = 28, //! A demoted keyword. DemotedKeyword = 29, //! stdin. Stdin = 30, //! stdout. Stdout = 31, //! stderr. Stderr = 40 }; //! Construct a QsciLexerRuby with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerRuby(QObject *parent = 0); //! Destroys the QsciLexerRuby instance. virtual ~QsciLexerRuby(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns a space separated list of words or characters in //! a particular style that define the end of a block for //! auto-indentation. The style is returned via \a style. const char *blockEnd(int *style = 0) const; //! \internal Returns a space separated list of words or characters in //! a particular style that define the start of a block for //! auto-indentation. The styles is returned via \a style. const char *blockStart(int *style = 0) const; //! \internal Returns a space separated list of keywords in a //! particular style that define the start of a block for //! auto-indentation. The style is returned via \a style. const char *blockStartKeyword(int *style = 0) const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultpaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the style //! is invalid for this language then an empty QString is returned. This //! is intended to be used in user preference dialogs. QString description(int style) const; private: QsciLexerRuby(const QsciLexerRuby &); QsciLexerRuby &operator=(const QsciLexerRuby &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerproperties.h0000644000175000001440000001027511407213302025175 0ustar subzerousers// This defines the interface to the QsciLexerProperties class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERPROPERTIES_H #define QSCILEXERPROPERTIES_H extern "C++" { #include #include #include //! \brief The QsciLexerProperties class encapsulates the Scintilla //! Properties lexer. class QSCINTILLA_EXPORT QsciLexerProperties : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! Properties lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A section. Section = 2, //! An assignment operator. Assignment = 3, //! A default value. DefaultValue = 4 }; //! Construct a QsciLexerProperties with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerProperties(QObject *parent = 0); //! Destroys the QsciLexerProperties instance. virtual ~QsciLexerProperties(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. void refreshProperties(); //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; public slots: //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! //! \sa writeProperties() bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! //! \sa readProperties() bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCompactProp(); bool fold_compact; QsciLexerProperties(const QsciLexerProperties &); QsciLexerProperties &operator=(const QsciLexerProperties &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerpython.h0000644000175000001440000001614411407213302024323 0ustar subzerousers// This defines the interface to the QsciLexerPython class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERPYTHON_H #define QSCILEXERPYTHON_H extern "C++" { #include #include #include //! \brief The QsciLexerPython class encapsulates the Scintilla Python lexer. class QSCINTILLA_EXPORT QsciLexerPython : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! Python lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A number. Number = 2, //! A double-quoted string. DoubleQuotedString = 3, //! A single-quoted string. SingleQuotedString = 4, //! A keyword. Keyword = 5, //! A triple single-quoted string. TripleSingleQuotedString = 6, //! A triple double-quoted string. TripleDoubleQuotedString = 7, //! The name of a class. ClassName = 8, //! The name of a function or method. FunctionMethodName = 9, //! An operator. Operator = 10, //! An identifier Identifier = 11, //! A comment block. CommentBlock = 12, //! The end of a line where a string is not closed. UnclosedString = 13, //! A highlighted identifier. These are defined by keyword set //! 2. Reimplement keywords() to define keyword set 2. HighlightedIdentifier = 14, //! A decorator. Decorator = 15 }; //! This enum defines the different conditions that can cause //! indentations to be displayed as being bad. enum IndentationWarning { //! Bad indentation is not displayed differently. NoWarning = 0, //! The indentation is inconsistent when compared to the //! previous line, ie. it is made up of a different combination //! of tabs and/or spaces. Inconsistent = 1, //! The indentation is made up of spaces followed by tabs. TabsAfterSpaces = 2, //! The indentation contains spaces. Spaces = 3, //! The indentation contains tabs. Tabs = 4 }; //! Construct a QsciLexerPython with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerPython(QObject *parent = 0); //! Destroys the QsciLexerPython instance. virtual ~QsciLexerPython(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the character sequences that can separate //! auto-completion words. QStringList autoCompletionWordSeparators() const; //! \internal Returns the number of lines prior to the current one when //! determining the scope of a block when auto-indenting. int blockLookback() const; //! \internal Returns a space separated list of words or characters in //! a particular style that define the start of a block for //! auto-indentation. The styles is returned via \a style. const char *blockStart(int *style = 0) const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. void refreshProperties(); //! Returns true if indented comment blocks can be folded. //! //! \sa setFoldComments() bool foldComments() const; //! Returns true if triple quoted strings can be folded. //! //! \sa setFoldQuotes() bool foldQuotes() const; //! Returns the condition that will cause bad indentations to be //! displayed. //! //! \sa setIndentationWarning() QsciLexerPython::IndentationWarning indentationWarning() const; public slots: //! If \a fold is true then indented comment blocks can be folded. The //! default is false. //! //! \sa foldComments() virtual void setFoldComments(bool fold); //! If \a fold is true then triple quoted strings can be folded. The //! default is false. //! //! \sa foldQuotes() virtual void setFoldQuotes(bool fold); //! Sets the condition that will cause bad indentations to be //! displayed. //! //! \sa indentationWarning() virtual void setIndentationWarning(QsciLexerPython::IndentationWarning warn); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCommentProp(); void setQuotesProp(); void setTabWhingeProp(); bool fold_comments; bool fold_quotes; IndentationWarning indent_warn; friend class QsciLexerHTML; static const char *keywordClass; QsciLexerPython(const QsciLexerPython &); QsciLexerPython &operator=(const QsciLexerPython &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexer.h0000644000175000001440000002721711407213302023064 0ustar subzerousers// This defines the interface to the QsciLexer class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXER_H #define QSCILEXER_H extern "C++" { #include #include #include #include #include #include class QSettings; class QsciAPIs; //! \brief The QsciLexer class is an abstract class used as a base for specific //! existing Scintilla language lexers. //! //! A Scintilla lexer scans the text breaking it up into separate language //! objects, e.g. keywords, strings, operators. The lexer then uses a //! different style to draw each object. A style is identified by a style //! number and has a number of attributes, including colour and font. A //! specific language lexer will implement appropriate default styles which can //! be overriden by an application by further sub-classing the specific //! language lexer. //! //! A specific language lexer may provide one or more sets of words to be //! recognised as keywords. Most lexers only provide one set, but some may //! support languages embedded in other languages and provide several sets. //! //! QsciLexer provides convenience methods for saving and restoring user //! preferences for fonts and colours. Note that QSciLexer is not a means to //! writing new lexers - you must do that by adding a new lexer to the //! underlying Scintilla code. class QSCINTILLA_EXPORT QsciLexer : public QObject { Q_OBJECT public: //! Construct a QsciLexer with parent \a parent. \a parent is typically //! the QsciScintilla instance. QsciLexer(QObject *parent = 0); //! Destroy the QSciLexer. virtual ~QsciLexer(); //! Returns the name of the language. It must be re-implemented by a //! sub-class. virtual const char *language() const = 0; //! Returns the name of the lexer. Some lexers support a number of //! languages. It must be re-implemented by a sub-class. virtual const char *lexer() const = 0; //! Returns the current API set or 0 if there isn't one. //! //! \sa setAPIs() QsciAPIs *apis() const; //! \internal Returns the characters that can fill up auto-completion. virtual const char *autoCompletionFillups() const; //! \internal Returns the list of character sequences that can separate //! auto-completion words. The first in the list is assumed to be the //! sequence used to separate words in the lexer's API files. virtual QStringList autoCompletionWordSeparators() const; //! Returns the auto-indentation style. The default is 0 if the //! language is block structured, or QsciScintilla::AiMaintain if not. //! //! \sa setAutoIndentStyle(), QsciScintilla::AiMaintain, //! QsciScintilla::AiOpening, QsciScintilla::AiClosing int autoIndentStyle(); //! \internal Returns a space separated list of words or characters in //! a particular style that define the end of a block for //! auto-indentation. The style is returned via \a style. virtual const char *blockEnd(int *style = 0) const; //! \internal Returns the number of lines prior to the current one when //! determining the scope of a block when auto-indenting. virtual int blockLookback() const; //! \internal Returns a space separated list of words or characters in //! a particular style that define the start of a block for //! auto-indentation. The style is returned via \a style. virtual const char *blockStart(int *style = 0) const; //! \internal Returns a space separated list of keywords in a //! particular style that define the start of a block for //! auto-indentation. The style is returned via \a style. virtual const char *blockStartKeyword(int *style = 0) const; //! \internal Returns the style used for braces for brace matching. virtual int braceStyle() const; //! \internal Returns true if the language is case sensitive. The default //! is true. virtual bool caseSensitive() const; //! Returns the foreground colour of the text for style number \a style. //! The default colour is that returned by defaultColor(). //! //! \sa defaultColor(), paper() virtual QColor color(int style) const; //! Returns the end-of-line for style number \a style. The default is //! false. virtual bool eolFill(int style) const; //! Returns the font for style number \a style. The default font is //! that returned by defaultFont(). //! //! \sa defaultFont() virtual QFont font(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. 0 is returned if there //! is no such set. virtual const char *keywords(int set) const; //! \internal Returns the number of the style used for whitespace. The //! default implementation returns 0 which is the convention adopted by //! most lexers. virtual int defaultStyle() const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. virtual QString description(int style) const = 0; //! Returns the background colour of the text for style number //! \a style. //! //! \sa defaultPaper(), color() virtual QColor paper(int style) const; //! Returns the default text colour. //! //! \sa setDefaultColor() QColor defaultColor() const; //! Returns the default text colour for style number \a style. virtual QColor defaultColor(int style) const; //! Returns the default end-of-line for style number \a style. The default //! is false. virtual bool defaultEolFill(int style) const; //! Returns the default font. //! //! \sa setDefaultFont() QFont defaultFont() const; //! Returns the default font for style number \a style. virtual QFont defaultFont(int style) const; //! Returns the default paper colour. //! //! \sa setDefaultPaper() QColor defaultPaper() const; //! Returns the default paper colour for style number \a style. virtual QColor defaultPaper(int style) const; //! The current set of APIs is set to \a apis. If \a apis is 0 then any //! existing APIs for this lexer are removed. //! //! \sa apis() void setAPIs(QsciAPIs *apis); //! The default text colour is set to \a c. //! //! \sa defaultColor(), color() void setDefaultColor(const QColor &c); //! The default font is set to \a f. //! //! \sa defaultFont(), font() void setDefaultFont(const QFont &f); //! The default paper colour is set to \a c. //! //! \sa defaultPaper(), paper() void setDefaultPaper(const QColor &c); //! The colour, paper, font and end-of-line for each style number, and //! all lexer specific properties are read from the settings \a qs. //! \a prefix is prepended to the key of each entry. true is returned //! if there was no error. //! //! \sa writeSettings(), QsciScintilla::setLexer() bool readSettings(QSettings &qs,const char *prefix = "/Scintilla"); //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. virtual void refreshProperties(); //! \internal Returns the string of characters that comprise a word. //! The default is 0 which implies the upper and lower case alphabetic //! characters and underscore. virtual const char *wordCharacters() const; //! The colour, paper, font and end-of-line for each style number, and //! all lexer specific properties are written to the settings \a qs. //! \a prefix is prepended to the key of each entry. true is returned //! if there was no error. //! //! \sa readSettings() bool writeSettings(QSettings &qs, const char *prefix = "/Scintilla") const; public slots: //! The auto-indentation style is set to \a autoindentstyle. //! //! \sa autoIndentStyle(), QsciScintilla::AiMaintain, //! QsciScintilla::AiOpening, QsciScintilla::AiClosing virtual void setAutoIndentStyle(int autoindentstyle); //! The foreground colour for style number \a style is set to \a c. If //! \a style is -1 then the colour is set for all styles. virtual void setColor(const QColor &c,int style = -1); //! The end-of-line fill for style number \a style is set to //! \a eoffill. If \a style is -1 then the fill is set for all styles. virtual void setEolFill(bool eoffill,int style = -1); //! The font for style number \a style is set to \a f. If \a style is //! -1 then the font is set for all styles. virtual void setFont(const QFont &f,int style = -1); //! The background colour for style number \a style is set to \a c. If //! \a style is -1 then the colour is set for all styles. virtual void setPaper(const QColor &c,int style = -1); signals: //! This signal is emitted when the foreground colour of style number //! \a style has changed. The new colour is \a c. void colorChanged(const QColor &c,int style); //! This signal is emitted when the end-of-file fill of style number //! \a style has changed. The new fill is \a eolfilled. void eolFillChanged(bool eolfilled,int style); //! This signal is emitted when the font of style number \a style has //! changed. The new font is \a f. void fontChanged(const QFont &f,int style); //! This signal is emitted when the background colour of style number //! \a style has changed. The new colour is \a c. void paperChanged(const QColor &c,int style); //! This signal is emitted when the value of the lexer property \a prop //! needs to be changed. The new value is \a val. void propertyChanged(const char *prop, const char *val); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! virtual bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! virtual bool writeProperties(QSettings &qs,const QString &prefix) const; private: struct StyleData { QFont font; QColor color; QColor paper; bool eol_fill; }; struct StyleDataMap { bool style_data_set; QMap style_data; }; StyleDataMap *style_map; int autoIndStyle; QFont defFont; QColor defColor; QColor defPaper; QsciAPIs *apiSet; void setStyleDefaults() const; StyleData &styleData(int style) const; QsciLexer(const QsciLexer &); QsciLexer &operator=(const QsciLexer &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerbatch.h0000644000175000001440000000660211407213302024061 0ustar subzerousers// This defines the interface to the QsciLexerBatch class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERBATCH_H #define QSCILEXERBATCH_H extern "C++" { #include #include #include //! \brief The QsciLexerBatch class encapsulates the Scintilla batch file //! lexer. class QSCINTILLA_EXPORT QsciLexerBatch : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! batch file lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A keyword. Keyword = 2, //! A label. Label = 3, //! An hide command character. HideCommandChar = 4, //! An external command . ExternalCommand = 5, //! A variable. Variable = 6, //! An operator Operator = 7 }; //! Construct a QsciLexerBatch with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerBatch(QObject *parent = 0); //! Destroys the QsciLexerBatch instance. virtual ~QsciLexerBatch(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! \internal Returns true if the language is case sensitive. bool caseSensitive() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; private: QsciLexerBatch(const QsciLexerBatch &); QsciLexerBatch &operator=(const QsciLexerBatch &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qsciscintillabase.h0000644000175000001440000016151211407213302024557 0ustar subzerousers// This class defines the "official" low-level API. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCISCINTILLABASE_H #define QSCISCINTILLABASE_H extern "C++" { #include #include #include #include #include class QColor; class QPainter; class QPixmap; class ScintillaQt; //! \brief The QsciScintillaBase class implements the Scintilla editor widget //! and its low-level API. //! //! Scintilla (http://www.scintilla.org) is a powerful C++ editor class that //! supports many features including syntax styling, error indicators, code //! completion and call tips. It is particularly useful as a programmer's //! editor. //! //! QsciScintillaBase is a port to Qt of Scintilla. It implements the standard //! Scintilla API which consists of a number of messages each taking up to //! two arguments. //! //! See QsciScintilla for the implementation of a higher level API that is more //! consistent with the rest of the Qt toolkit. class QSCINTILLA_EXPORT QsciScintillaBase : public QAbstractScrollArea { Q_OBJECT public: //! The low-level Scintilla API is implemented as a set of messages each of //! which takes up to two parameters (\a wParam and \a lParam) and //! optionally return a value. This enum defines all the possible messages. enum { //! SCI_START = 2000, //! SCI_OPTIONAL_START = 3000, //! SCI_LEXER_START = 4000, //! This message appends some text to the end of the document. //! \a wParam is the length of the text. //! \a lParam is the text to be appended. SCI_ADDTEXT = 2001, //! SCI_ADDSTYLEDTEXT = 2002, //! SCI_INSERTTEXT = 2003, //! SCI_CLEARALL = 2004, //! SCI_CLEARDOCUMENTSTYLE = 2005, //! SCI_GETLENGTH = 2006, //! SCI_GETCHARAT = 2007, //! This message returns the current position. //! //! \sa SCI_SETCURRENTPOS SCI_GETCURRENTPOS = 2008, //! This message returns the anchor. //! //! \sa SCI_SETANCHOR SCI_GETANCHOR = 2009, //! SCI_GETSTYLEAT = 2010, //! SCI_REDO = 2011, //! SCI_SETUNDOCOLLECTION = 2012, //! SCI_SELECTALL = 2013, //! This message marks the current state of the text as the the save //! point. This is usually done when the text is saved or loaded. //! //! \sa SCN_SAVEPOINTREACHED(), SCN_SAVEPOINTLEFT() SCI_SETSAVEPOINT = 2014, //! SCI_GETSTYLEDTEXT = 2015, //! SCI_CANREDO = 2016, //! This message returns the line that contains a particular instance //! of a marker. //! \a wParam is the handle of the marker. //! //! \sa SCI_MARKERADD SCI_MARKERLINEFROMHANDLE = 2017, //! This message removes a particular instance of a marker. //! \a wParam is the handle of the marker. //! //! \sa SCI_MARKERADD SCI_MARKERDELETEHANDLE = 2018, //! SCI_GETUNDOCOLLECTION = 2019, //! SCI_GETVIEWWS = 2020, //! SCI_SETVIEWWS = 2021, //! SCI_POSITIONFROMPOINT = 2022, //! SCI_POSITIONFROMPOINTCLOSE = 2023, //! SCI_GOTOLINE = 2024, //! This message clears the current selection and sets the current //! position. //! \a wParam is the new current position. //! //! \sa SCI_SETCURRENTPOS SCI_GOTOPOS = 2025, //! This message sets the anchor. //! \a wParam is the new anchor. //! //! \sa SCI_GETANCHOR SCI_SETANCHOR = 2026, //! SCI_GETCURLINE = 2027, //! This message returns the character position of the start of the //! text that needs to be syntax styled. //! //! \sa SCN_STYLENEEDED() SCI_GETENDSTYLED = 2028, //! SCI_CONVERTEOLS = 2029, //! SCI_GETEOLMODE = 2030, //! SCI_SETEOLMODE = 2031, //! SCI_STARTSTYLING = 2032, //! SCI_SETSTYLING = 2033, //! SCI_GETBUFFEREDDRAW = 2034, //! SCI_SETBUFFEREDDRAW = 2035, //! SCI_SETTABWIDTH = 2036, //! SCI_GETTABWIDTH = 2121, //! SCI_SETCODEPAGE = 2037, //! SCI_SETUSEPALETTE = 2039, //! This message sets the symbol used to draw one of 32 markers. Some //! markers have pre-defined uses, see the SC_MARKNUM_* values. //! \a wParam is the number of the marker. //! \a lParam is the marker symbol and is one of the SC_MARK_* values. //! //! \sa SCI_MARKERADD, SCI_MARKERDEFINEPIXMAP SCI_MARKERDEFINE = 2040, //! This message sets the foreground colour used to draw a marker. A //! colour is represented as a 24 bit value. The 8 least significant //! bits correspond to red, the middle 8 bits correspond to green, and //! the 8 most significant bits correspond to blue. The default value //! is 0x000000. //! \a wParam is the number of the marker. //! \a lParam is the colour. //! //! \sa SCI_MARKERSETBACK SCI_MARKERSETFORE = 2041, //! This message sets the background colour used to draw a marker. A //! colour is represented as a 24 bit value. The 8 least significant //! bits correspond to red, the middle 8 bits correspond to green, and //! the 8 most significant bits correspond to blue. The default value //! is 0xffffff. //! \a wParam is the number of the marker. //! \a lParam is the colour. //! //! \sa SCI_MARKERSETFORE SCI_MARKERSETBACK = 2042, //! This message adds a marker to a line. A handle for the marker is //! returned which can be used to track the marker's position. //! \a wParam is the line number. //! \a lParam is the number of the marker. //! //! \sa SCI_MARKERDELETE, SCI_MARKERDELETEALL, //! SCI_MARKERDELETEHANDLE SCI_MARKERADD = 2043, //! This message deletes a marker from a line. //! \a wParam is the line number. //! \a lParam is the number of the marker. //! //! \sa SCI_MARKERADD, SCI_MARKERDELETEALL SCI_MARKERDELETE = 2044, //! This message deletes all occurences of a marker. //! \a wParam is the number of the marker. If \a wParam is -1 then all //! markers are removed. //! //! \sa SCI_MARKERADD, SCI_MARKERDELETE SCI_MARKERDELETEALL = 2045, //! This message returns the 32 bit mask of markers at a line. //! \a wParam is the line number. SCI_MARKERGET = 2046, //! This message looks for the next line to contain at least one marker //! contained in a 32 bit mask of markers and returns the line number. //! \a wParam is the line number to start the search from. //! \a lParam is the mask of markers to search for. //! //! \sa SCI_MARKERPREVIOUS SCI_MARKERNEXT = 2047, //! This message looks for the previous line to contain at least one //! marker contained in a 32 bit mask of markers and returns the line //! number. //! \a wParam is the line number to start the search from. //! \a lParam is the mask of markers to search for. //! //! \sa SCI_MARKERNEXT SCI_MARKERPREVIOUS = 2048, //! This message sets the symbol used to draw one of the 32 markers to //! a pixmap. Pixmaps use the SC_MARK_PIXMAP marker symbol. //! \a wParam is the number of the marker. //! \a lParam is a pointer to a QPixmap instance. Note that in other //! ports of Scintilla this is a pointer to either raw or textual XPM //! image data. //! //! \sa SCI_MARKERDEFINE SCI_MARKERDEFINEPIXMAP = 2049, //! This message sets what can be displayed in a margin. //! \a wParam is the number of the margin: 0, 1 or 2. //! \a lParam is the logical or of the SC_MARGIN_* values. //! //! \sa SCI_GETMARGINTYPEN SCI_SETMARGINTYPEN = 2240, //! This message returns what can be displayed in a margin. //! \a wParam is the number of the margin: 0, 1 or 2. //! //! \sa SCI_SETMARGINTYPEN SCI_GETMARGINTYPEN = 2241, //! This message sets the width of a margin in pixels. //! \a wParam is the number of the margin: 0, 1 or 2. //! \a lParam is the new margin width. //! //! \sa SCI_GETMARGINWIDTHN SCI_SETMARGINWIDTHN = 2242, //! This message returns the width of a margin in pixels. //! \a wParam is the number of the margin: 0, 1 or 2. //! //! \sa SCI_SETMARGINWIDTHN SCI_GETMARGINWIDTHN = 2243, //! This message sets the mask of a margin. The mask is a 32 value //! with one bit for each possible marker. If a bit is set then the //! corresponding marker is displayed. By default, all markers are //! displayed. //! \a wParam is the number of the margin: 0, 1 or 2. //! \a lParam is the new margin mask. //! //! \sa SCI_GETMARGINMASKN, SCI_MARKERDEFINE SCI_SETMARGINMASKN = 2244, //! This message returns the mask of a margin. //! \a wParam is the number of the margin: 0, 1 or 2. //! //! \sa SCI_SETMARGINMASKN SCI_GETMARGINMASKN = 2245, //! This message sets the sensitivity of a margin to mouse clicks. //! \a wParam is the number of the margin: 0, 1 or 2. //! \a lParam is non-zero to make the margin sensitive to mouse clicks. //! When the mouse is clicked the SCN_MARGINCLICK() signal is emitted. //! //! \sa SCI_GETMARGINSENSITIVEN, SCN_MARGINCLICK() SCI_SETMARGINSENSITIVEN = 2246, //! This message returns the sensitivity of a margin to mouse clicks. //! \a wParam is the number of the margin: 0, 1 or 2. //! //! \sa SCI_SETMARGINSENSITIVEN, SCN_MARGINCLICK() SCI_GETMARGINSENSITIVEN = 2247, //! SCI_STYLECLEARALL = 2050, //! SCI_STYLESETFORE = 2051, //! SCI_STYLESETBACK = 2052, //! SCI_STYLESETBOLD = 2053, //! SCI_STYLESETITALIC = 2054, //! SCI_STYLESETSIZE = 2055, //! SCI_STYLESETFONT = 2056, //! SCI_STYLESETEOLFILLED = 2057, //! SCI_STYLERESETDEFAULT = 2058, //! SCI_STYLESETUNDERLINE = 2059, //! SCI_STYLESETCASE = 2060, //! SCI_STYLESETCHARACTERSET = 2066, //! SCI_SETSELFORE = 2067, //! SCI_SETSELBACK = 2068, //! SCI_SETCARETFORE = 2069, //! SCI_ASSIGNCMDKEY = 2070, //! SCI_CLEARCMDKEY = 2071, //! SCI_CLEARALLCMDKEYS = 2072, //! SCI_SETSTYLINGEX = 2073, //! SCI_STYLESETVISIBLE = 2074, //! SCI_GETCARETPERIOD = 2075, //! SCI_SETCARETPERIOD = 2076, //! SCI_SETWORDCHARS = 2077, //! SCI_BEGINUNDOACTION = 2078, //! SCI_ENDUNDOACTION = 2079, //! SCI_INDICSETSTYLE = 2080, //! SCI_INDICGETSTYLE = 2081, //! SCI_INDICSETFORE = 2082, //! SCI_INDICGETFORE = 2083, //! SCI_SETWHITESPACEFORE = 2084, //! SCI_SETWHITESPACEBACK = 2085, //! SCI_SETSTYLEBITS = 2090, //! SCI_GETSTYLEBITS = 2091, //! SCI_SETLINESTATE = 2092, //! SCI_GETLINESTATE = 2093, //! SCI_GETMAXLINESTATE = 2094, //! SCI_GETCARETLINEVISIBLE = 2095, //! SCI_SETCARETLINEVISIBLE = 2096, //! SCI_GETCARETLINEBACK = 2097, //! SCI_SETCARETLINEBACK = 2098, //! SCI_STYLESETCHANGEABLE = 2099, //! SCI_AUTOCSHOW = 2100, //! SCI_AUTOCCANCEL = 2101, //! SCI_AUTOCACTIVE = 2102, //! SCI_AUTOCPOSSTART = 2103, //! SCI_AUTOCCOMPLETE = 2104, //! SCI_AUTOCSTOPS = 2105, //! SCI_AUTOCSETSEPARATOR = 2106, //! SCI_AUTOCGETSEPARATOR = 2107, //! SCI_AUTOCSELECT = 2108, //! SCI_AUTOCSETCANCELATSTART = 2110, //! SCI_AUTOCGETCANCELATSTART = 2111, //! SCI_AUTOCSETFILLUPS = 2112, //! SCI_AUTOCSETCHOOSESINGLE = 2113, //! SCI_AUTOCGETCHOOSESINGLE = 2114, //! SCI_AUTOCSETIGNORECASE = 2115, //! SCI_AUTOCGETIGNORECASE = 2116, //! SCI_USERLISTSHOW = 2117, //! SCI_AUTOCSETAUTOHIDE = 2118, //! SCI_AUTOCGETAUTOHIDE = 2119, //! SCI_AUTOCSETDROPRESTOFWORD = 2270, //! SCI_AUTOCGETDROPRESTOFWORD = 2271, //! SCI_SETINDENT = 2122, //! SCI_GETINDENT = 2123, //! SCI_SETUSETABS = 2124, //! SCI_GETUSETABS = 2125, //! SCI_SETLINEINDENTATION = 2126, //! SCI_GETLINEINDENTATION = 2127, //! SCI_GETLINEINDENTPOSITION = 2128, //! SCI_GETCOLUMN = 2129, //! SCI_SETHSCROLLBAR = 2130, //! SCI_GETHSCROLLBAR = 2131, //! SCI_SETINDENTATIONGUIDES = 2132, //! SCI_GETINDENTATIONGUIDES = 2133, //! SCI_SETHIGHLIGHTGUIDE = 2134, //! SCI_GETHIGHLIGHTGUIDE = 2135, //! SCI_GETLINEENDPOSITION = 2136, //! SCI_GETCODEPAGE = 2137, //! SCI_GETCARETFORE = 2138, //! SCI_GETUSEPALETTE = 2139, //! This message returns a non-zero value if the document is read-only. //! //! \sa SCI_SETREADONLY SCI_GETREADONLY = 2140, //! This message sets the current position. //! \a wParam is the new current position. //! //! \sa SCI_GETCURRENTPOS SCI_SETCURRENTPOS = 2141, //! SCI_SETSELECTIONSTART = 2142, //! SCI_GETSELECTIONSTART = 2143, //! SCI_SETSELECTIONEND = 2144, //! SCI_GETSELECTIONEND = 2145, //! SCI_SETPRINTMAGNIFICATION = 2146, //! SCI_GETPRINTMAGNIFICATION = 2147, //! SCI_SETPRINTCOLOURMODE = 2148, //! SCI_GETPRINTCOLOURMODE = 2149, //! SCI_FINDTEXT = 2150, //! SCI_FORMATRANGE = 2151, //! SCI_GETFIRSTVISIBLELINE = 2152, //! SCI_GETLINE = 2153, //! SCI_GETLINECOUNT = 2154, //! SCI_SETMARGINLEFT = 2155, //! SCI_GETMARGINLEFT = 2156, //! SCI_SETMARGINRIGHT = 2157, //! SCI_GETMARGINRIGHT = 2158, //! This message returns a non-zero value if the document has been //! modified. SCI_GETMODIFY = 2159, //! SCI_SETSEL = 2160, //! SCI_GETSELTEXT = 2161, //! SCI_GETTEXTRANGE = 2162, //! SCI_HIDESELECTION = 2163, //! SCI_POINTXFROMPOSITION = 2164, //! SCI_POINTYFROMPOSITION = 2165, //! SCI_LINEFROMPOSITION = 2166, //! SCI_POSITIONFROMLINE = 2167, //! SCI_LINESCROLL = 2168, //! SCI_SCROLLCARET = 2169, //! SCI_REPLACESEL = 2170, //! This message sets the read-only state of the document. //! \a wParam is the new read-only state of the document. //! //! \sa SCI_GETREADONLY SCI_SETREADONLY = 2171, //! SCI_NULL = 2172, //! SCI_CANPASTE = 2173, //! SCI_CANUNDO = 2174, //! This message empties the undo buffer. SCI_EMPTYUNDOBUFFER = 2175, //! SCI_UNDO = 2176, //! SCI_CUT = 2177, //! SCI_COPY = 2178, //! SCI_PASTE = 2179, //! SCI_CLEAR = 2180, //! This message sets the text of the document. //! \a wParam is unused. //! \a lParam is the new text of the document. //! //! \sa SCI_GETTEXT SCI_SETTEXT = 2181, //! This message gets the text of the document. //! \a wParam is size of the buffer that the text is copied to. //! \a lParam is the address of the buffer that the text is copied to. //! //! \sa SCI_SETTEXT SCI_GETTEXT = 2182, //! This message returns the length of the document. SCI_GETTEXTLENGTH = 2183, //! SCI_GETDIRECTFUNCTION = 2184, //! SCI_GETDIRECTPOINTER = 2185, //! SCI_SETOVERTYPE = 2186, //! SCI_GETOVERTYPE = 2187, //! SCI_SETCARETWIDTH = 2188, //! SCI_GETCARETWIDTH = 2189, //! SCI_SETTARGETSTART = 2190, //! SCI_GETTARGETSTART = 2191, //! SCI_SETTARGETEND = 2192, //! SCI_GETTARGETEND = 2193, //! SCI_REPLACETARGET = 2194, //! SCI_REPLACETARGETRE = 2195, //! SCI_SEARCHINTARGET = 2197, //! SCI_SETSEARCHFLAGS = 2198, //! SCI_GETSEARCHFLAGS = 2199, //! SCI_CALLTIPSHOW = 2200, //! SCI_CALLTIPCANCEL = 2201, //! SCI_CALLTIPACTIVE = 2202, //! SCI_CALLTIPPOSSTART = 2203, //! SCI_CALLTIPSETHLT = 2204, //! SCI_CALLTIPSETBACK = 2205, //! SCI_CALLTIPSETFORE = 2206, //! SCI_CALLTIPSETFOREHLT = 2207, //! SCI_AUTOCSETMAXWIDTH = 2208, //! SCI_AUTOCGETMAXWIDTH = 2209, //! This message is not implemented. SCI_AUTOCSETMAXHEIGHT = 2210, //! SCI_AUTOCGETMAXHEIGHT = 2211, //! SCI_CALLTIPUSESTYLE = 2212, //! SCI_VISIBLEFROMDOCLINE = 2220, //! SCI_DOCLINEFROMVISIBLE = 2221, //! SCI_SETFOLDLEVEL = 2222, //! SCI_GETFOLDLEVEL = 2223, //! SCI_GETLASTCHILD = 2224, //! SCI_GETFOLDPARENT = 2225, //! SCI_SHOWLINES = 2226, //! SCI_HIDELINES = 2227, //! SCI_GETLINEVISIBLE = 2228, //! SCI_SETFOLDEXPANDED = 2229, //! SCI_GETFOLDEXPANDED = 2230, //! SCI_TOGGLEFOLD = 2231, //! SCI_ENSUREVISIBLE = 2232, //! SCI_SETFOLDFLAGS = 2233, //! SCI_ENSUREVISIBLEENFORCEPOLICY = 2234, //! SCI_WRAPCOUNT = 2235, //! SCI_SETTABINDENTS = 2260, //! SCI_GETTABINDENTS = 2261, //! SCI_SETBACKSPACEUNINDENTS = 2262, //! SCI_GETBACKSPACEUNINDENTS = 2263, //! SCI_SETMOUSEDWELLTIME = 2264, //! SCI_GETMOUSEDWELLTIME = 2265, //! SCI_WORDSTARTPOSITION = 2266, //! SCI_WORDENDPOSITION = 2267, //! SCI_SETWRAPMODE = 2268, //! SCI_GETWRAPMODE = 2269, //! SCI_SETLAYOUTCACHE = 2272, //! SCI_GETLAYOUTCACHE = 2273, //! SCI_SETSCROLLWIDTH = 2274, //! SCI_GETSCROLLWIDTH = 2275, //! This message returns the width of some text when rendered in a //! particular style. //! \a wParam is the style number and is one of the STYLE_* values or //! one of the styles defined by a lexer. //! \a lParam is a pointer to the text. SCI_TEXTWIDTH = 2276, //! SCI_SETENDATLASTLINE = 2277, //! SCI_GETENDATLASTLINE = 2278, //! SCI_TEXTHEIGHT = 2279, //! SCI_SETVSCROLLBAR = 2280, //! SCI_GETVSCROLLBAR = 2281, //! SCI_APPENDTEXT = 2282, //! SCI_GETTWOPHASEDRAW = 2283, //! SCI_SETTWOPHASEDRAW = 2284, //! SCI_AUTOCGETTYPESEPARATOR = 2285, //! SCI_AUTOCSETTYPESEPARATOR = 2286, //! SCI_TARGETFROMSELECTION = 2287, //! SCI_LINESJOIN = 2288, //! SCI_LINESSPLIT = 2289, //! SCI_SETFOLDMARGINCOLOUR = 2290, //! SCI_SETFOLDMARGINHICOLOUR = 2291, //! SCI_LINEDOWN = 2300, //! SCI_LINEDOWNEXTEND = 2301, //! SCI_LINEUP = 2302, //! SCI_LINEUPEXTEND = 2303, //! SCI_CHARLEFT = 2304, //! SCI_CHARLEFTEXTEND = 2305, //! SCI_CHARRIGHT = 2306, //! SCI_CHARRIGHTEXTEND = 2307, //! SCI_WORDLEFT = 2308, //! SCI_WORDLEFTEXTEND = 2309, //! SCI_WORDRIGHT = 2310, //! SCI_WORDRIGHTEXTEND = 2311, //! SCI_HOME = 2312, //! SCI_HOMEEXTEND = 2313, //! SCI_LINEEND = 2314, //! SCI_LINEENDEXTEND = 2315, //! SCI_DOCUMENTSTART = 2316, //! SCI_DOCUMENTSTARTEXTEND = 2317, //! SCI_DOCUMENTEND = 2318, //! SCI_DOCUMENTENDEXTEND = 2319, //! SCI_PAGEUP = 2320, //! SCI_PAGEUPEXTEND = 2321, //! SCI_PAGEDOWN = 2322, //! SCI_PAGEDOWNEXTEND = 2323, //! SCI_EDITTOGGLEOVERTYPE = 2324, //! SCI_CANCEL = 2325, //! SCI_DELETEBACK = 2326, //! SCI_TAB = 2327, //! SCI_BACKTAB = 2328, //! SCI_NEWLINE = 2329, //! SCI_FORMFEED = 2330, //! SCI_VCHOME = 2331, //! SCI_VCHOMEEXTEND = 2332, //! SCI_ZOOMIN = 2333, //! SCI_ZOOMOUT = 2334, //! SCI_DELWORDLEFT = 2335, //! SCI_DELWORDRIGHT = 2336, //! SCI_LINECUT = 2337, //! SCI_LINEDELETE = 2338, //! SCI_LINETRANSPOSE = 2339, //! SCI_LOWERCASE = 2340, //! SCI_UPPERCASE = 2341, //! SCI_LINESCROLLDOWN = 2342, //! SCI_LINESCROLLUP = 2343, //! SCI_DELETEBACKNOTLINE = 2344, //! SCI_HOMEDISPLAY = 2345, //! SCI_HOMEDISPLAYEXTEND = 2346, //! SCI_LINEENDDISPLAY = 2347, //! SCI_LINEENDDISPLAYEXTEND = 2348, //! SCI_MOVECARETINSIDEVIEW = 2401, //! SCI_LINELENGTH = 2350, //! SCI_BRACEHIGHLIGHT = 2351, //! SCI_BRACEBADLIGHT = 2352, //! SCI_BRACEMATCH = 2353, //! SCI_GETVIEWEOL = 2355, //! SCI_SETVIEWEOL = 2356, //! SCI_GETDOCPOINTER = 2357, //! SCI_SETDOCPOINTER = 2358, //! SCI_SETMODEVENTMASK = 2359, //! SCI_GETEDGECOLUMN = 2360, //! SCI_SETEDGECOLUMN = 2361, //! SCI_GETEDGEMODE = 2362, //! SCI_SETEDGEMODE = 2363, //! SCI_GETEDGECOLOUR = 2364, //! SCI_SETEDGECOLOUR = 2365, //! SCI_SEARCHANCHOR = 2366, //! SCI_SEARCHNEXT = 2367, //! SCI_SEARCHPREV = 2368, //! SCI_LINESONSCREEN = 2370, //! SCI_USEPOPUP = 2371, //! SCI_SELECTIONISRECTANGLE = 2372, //! SCI_SETZOOM = 2373, //! SCI_GETZOOM = 2374, //! SCI_CREATEDOCUMENT = 2375, //! SCI_ADDREFDOCUMENT = 2376, //! SCI_RELEASEDOCUMENT = 2377, //! SCI_GETMODEVENTMASK = 2378, //! SCI_SETFOCUS = 2380, //! SCI_GETFOCUS = 2381, //! SCI_SETSTATUS = 2382, //! SCI_GETSTATUS = 2383, //! SCI_SETMOUSEDOWNCAPTURES = 2384, //! SCI_GETMOUSEDOWNCAPTURES = 2385, //! SCI_SETCURSOR = 2386, //! SCI_GETCURSOR = 2387, //! SCI_SETCONTROLCHARSYMBOL = 2388, //! SCI_GETCONTROLCHARSYMBOL = 2389, //! SCI_WORDPARTLEFT = 2390, //! SCI_WORDPARTLEFTEXTEND = 2391, //! SCI_WORDPARTRIGHT = 2392, //! SCI_WORDPARTRIGHTEXTEND = 2393, //! SCI_SETVISIBLEPOLICY = 2394, //! SCI_DELLINELEFT = 2395, //! SCI_DELLINERIGHT = 2396, //! SCI_SETXOFFSET = 2397, //! SCI_GETXOFFSET = 2398, //! SCI_CHOOSECARETX = 2399, //! SCI_GRABFOCUS = 2400, //! SCI_SETXCARETPOLICY = 2402, //! SCI_SETYCARETPOLICY = 2403, //! SCI_LINEDUPLICATE = 2404, //! This message takes a copy of an image and registers it so that it //! can be refered to by a unique integer identifier. //! \a wParam is the image's identifier. //! \a lParam is a pointer to a QPixmap instance. Note that in other //! ports of Scintilla this is a pointer to either raw or textual XPM //! image data. //! //! \sa SCI_CLEARREGISTEREDIMAGES SCI_REGISTERIMAGE = 2405, //! SCI_SETPRINTWRAPMODE = 2406, //! SCI_GETPRINTWRAPMODE = 2407, //! This message de-registers all currently registered images. //! //! \sa SCI_REGISTERIMAGE SCI_CLEARREGISTEREDIMAGES = 2408, //! SCI_STYLESETHOTSPOT = 2409, //! SCI_SETHOTSPOTACTIVEFORE = 2410, //! SCI_SETHOTSPOTACTIVEBACK = 2411, //! SCI_SETHOTSPOTACTIVEUNDERLINE = 2412, //! SCI_PARADOWN = 2413, //! SCI_PARADOWNEXTEND = 2414, //! SCI_PARAUP = 2415, //! SCI_PARAUPEXTEND = 2416, //! SCI_POSITIONBEFORE = 2417, //! SCI_POSITIONAFTER = 2418, //! SCI_COPYRANGE = 2419, //! SCI_COPYTEXT = 2420, //! SCI_SETSELECTIONMODE = 2422, //! SCI_GETSELECTIONMODE = 2423, //! SCI_GETLINESELSTARTPOSITION = 2424, //! SCI_GETLINESELENDPOSITION = 2425, //! SCI_LINEDOWNRECTEXTEND = 2426, //! SCI_LINEUPRECTEXTEND = 2427, //! SCI_CHARLEFTRECTEXTEND = 2428, //! SCI_CHARRIGHTRECTEXTEND = 2429, //! SCI_HOMERECTEXTEND = 2430, //! SCI_VCHOMERECTEXTEND = 2431, //! SCI_LINEENDRECTEXTEND = 2432, //! SCI_PAGEUPRECTEXTEND = 2433, //! SCI_PAGEDOWNRECTEXTEND = 2434, //! SCI_STUTTEREDPAGEUP = 2435, //! SCI_STUTTEREDPAGEUPEXTEND = 2436, //! SCI_STUTTEREDPAGEDOWN = 2437, //! SCI_STUTTEREDPAGEDOWNEXTEND = 2438, //! SCI_WORDLEFTEND = 2439, //! SCI_WORDLEFTENDEXTEND = 2440, //! SCI_WORDRIGHTEND = 2441, //! SCI_WORDRIGHTENDEXTEND = 2442, //! SCI_SETWHITESPACECHARS = 2443, //! SCI_SETCHARSDEFAULT = 2444, //! SCI_AUTOCGETCURRENT = 2445, //! SCI_ALLOCATE = 2446, //! SCI_HOMEWRAP = 2349, //! SCI_HOMEWRAPEXTEND = 2450, //! SCI_LINEENDWRAP = 2451, //! SCI_LINEENDWRAPEXTEND = 2452, //! SCI_VCHOMEWRAP = 2453, //! SCI_VCHOMEWRAPEXTEND = 2454, //! SCI_LINECOPY = 2455, //! SCI_FINDCOLUMN = 2456, //! SCI_GETCARETSTICKY = 2457, //! SCI_SETCARETSTICKY = 2458, //! SCI_TOGGLECARETSTICKY = 2459, //! SCI_SETWRAPVISUALFLAGS = 2460, //! SCI_GETWRAPVISUALFLAGS = 2461, //! SCI_SETWRAPVISUALFLAGSLOCATION = 2462, //! SCI_GETWRAPVISUALFLAGSLOCATION = 2463, //! SCI_SETWRAPSTARTINDENT = 2464, //! SCI_GETWRAPSTARTINDENT = 2465, //! SCI_MARKERADDSET = 2466, //! SCI_SETPASTECONVERTENDINGS = 2467, //! SCI_GETPASTECONVERTENDINGS = 2468, //! SCI_SELECTIONDUPLICATE = 2469, //! SCI_SETCARETLINEBACKALPHA = 2470, //! SCI_GETCARETLINEBACKALPHA = 2471, //! SCI_MARKERSETALPHA = 2476, //! SCI_GETSELALPHA = 2477, //! SCI_SETSELALPHA = 2478, //! SCI_GETSELEOLFILLED = 2479, //! SCI_SETSELEOLFILLED = 2480, //! SCI_STYLEGETFORE = 2481, //! SCI_STYLEGETBACK = 2482, //! SCI_STYLEGETBOLD = 2483, //! SCI_STYLEGETITALIC = 2484, //! SCI_STYLEGETSIZE = 2485, //! SCI_STYLEGETFONT = 2486, //! SCI_STYLEGETEOLFILLED = 2487, //! SCI_STYLEGETUNDERLINE = 2488, //! SCI_STYLEGETCASE = 2489, //! SCI_STYLEGETCHARACTERSET = 2490, //! SCI_STYLEGETVISIBLE = 2491, //! SCI_STYLEGETCHANGEABLE = 2492, //! SCI_STYLEGETHOTSPOT = 2493, //! SCI_GETHOTSPOTACTIVEFORE = 2494, //! SCI_GETHOTSPOTACTIVEBACK = 2495, //! SCI_GETHOTSPOTACTIVEUNDERLINE = 2496, //! SCI_GETHOTSPOTSINGLELINE = 2497, //! SCI_SETINDICATORCURRENT = 2500, //! SCI_GETINDICATORCURRENT = 2501, //! SCI_SETINDICATORVALUE = 2502, //! SCI_GETINDICATORVALUE = 2503, //! SCI_INDICATORFILLRANGE = 2504, //! SCI_INDICATORCLEARRANGE = 2505, //! SCI_INDICATORALLONFOR = 2506, //! SCI_INDICATORVALUEAT = 2507, //! SCI_INDICATORSTART = 2508, //! SCI_INDICATOREND = 2509, //! SCI_INDICSETUNDER = 2510, //! SCI_INDICGETUNDER = 2511, //! SCI_SETCARETSTYLE = 2512, //! SCI_GETCARETSTYLE = 2513, //! SCI_SETPOSITIONCACHE = 2514, //! SCI_GETPOSITIONCACHE = 2515, //! SCI_STARTRECORD = 3001, //! SCI_STOPRECORD = 3002, //! This message sets the number of the lexer to use for syntax //! styling. //! \a wParam is the number of the lexer and is one of the SCLEX_* //! values. SCI_SETLEXER = 4001, //! This message returns the number of the lexer being used for syntax //! styling. SCI_GETLEXER = 4002, //! SCI_COLOURISE = 4003, //! SCI_SETPROPERTY = 4004, //! SCI_SETKEYWORDS = 4005, //! This message sets the name of the lexer to use for syntax styling. //! \a wParam is unused. //! \a lParam is the name of the lexer. SCI_SETLEXERLANGUAGE = 4006, //! SCI_LOADLEXERLIBRARY = 4007, //! SCI_GETPROPERTY = 4008, //! SCI_GETPROPERTYEXPANDED = 4009, //! SCI_GETPROPERTYINT = 4010, //! SCI_GETSTYLEBITSNEEDED = 4011 }; enum { SC_ALPHA_TRANSPARENT = 0, SC_ALPHA_OPAQUE = 255, SC_ALPHA_NOALPHA = 256 }; enum { SC_WRAPVISUALFLAG_NONE = 0x0000, SC_WRAPVISUALFLAG_END = 0x0001, SC_WRAPVISUALFLAG_START = 0x0002 }; enum { SC_WRAPVISUALFLAGLOC_DEFAULT = 0x0000, SC_WRAPVISUALFLAGLOC_END_BY_TEXT = 0x0001, SC_WRAPVISUALFLAGLOC_START_BY_TEXT = 0x0002 }; //! This enum defines the different selection modes. //! //! \sa SCI_GETSELECTIONMODE, SCI_SETSELECTIONMODE enum { SC_SEL_STREAM = 0, SC_SEL_RECTANGLE = 1, SC_SEL_LINES = 2 }; enum { SCWS_INVISIBLE = 0, SCWS_VISIBLEALWAYS = 1, SCWS_VISIBLEAFTERINDENT = 2 }; enum { SC_EOL_CRLF = 0, SC_EOL_CR = 1, SC_EOL_LF = 2 }; enum { SC_CP_DBCS = 1, SC_CP_UTF8 = 65001 }; //! This enum defines the different marker symbols. //! //! \sa SCI_MARKERDEFINE enum { //! A circle. SC_MARK_CIRCLE = 0, //! A rectangle. SC_MARK_ROUNDRECT = 1, //! A triangle pointing to the right. SC_MARK_ARROW = 2, //! A smaller rectangle. SC_MARK_SMALLRECT = 3, //! An arrow pointing to the right. SC_MARK_SHORTARROW = 4, //! An invisible marker that allows code to track the movement //! of lines. SC_MARK_EMPTY = 5, //! A triangle pointing down. SC_MARK_ARROWDOWN = 6, //! A drawn minus sign. SC_MARK_MINUS = 7, //! A drawn plus sign. SC_MARK_PLUS = 8, //! A vertical line drawn in the background colour. SC_MARK_VLINE = 9, //! A bottom left corner drawn in the background colour. SC_MARK_LCORNER = 10, //! A vertical line with a centre right horizontal line drawn //! in the background colour. SC_MARK_TCORNER = 11, //! A drawn plus sign in a box. SC_MARK_BOXPLUS = 12, //! A drawn plus sign in a connected box. SC_MARK_BOXPLUSCONNECTED = 13, //! A drawn minus sign in a box. SC_MARK_BOXMINUS = 14, //! A drawn minus sign in a connected box. SC_MARK_BOXMINUSCONNECTED = 15, //! A rounded bottom left corner drawn in the background //! colour. SC_MARK_LCORNERCURVE = 16, //! A vertical line with a centre right curved line drawn in //! the background colour. SC_MARK_TCORNERCURVE = 17, //! A drawn plus sign in a circle. SC_MARK_CIRCLEPLUS = 18, //! A drawn plus sign in a connected box. SC_MARK_CIRCLEPLUSCONNECTED = 19, //! A drawn minus sign in a circle. SC_MARK_CIRCLEMINUS = 20, //! A drawn minus sign in a connected circle. SC_MARK_CIRCLEMINUSCONNECTED = 21, //! No symbol is drawn but the line of text is drawn with the //! same background colour. SC_MARK_BACKGROUND = 22, //! Three drawn dots. SC_MARK_DOTDOTDOT = 23, //! Three drawn arrows pointing right. SC_MARK_ARROWS = 24, //! An XPM format pixmap. SC_MARK_PIXMAP = 25, //! A full rectangle. SC_MARK_FULLRECT = 26, //! Characters can be used as symbols by adding this to the ASCII value //! of the character. SC_MARK_CHARACTER = 10000 }; enum { SC_MARKNUM_FOLDEREND = 25, SC_MARKNUM_FOLDEROPENMID = 26, SC_MARKNUM_FOLDERMIDTAIL = 27, SC_MARKNUM_FOLDERTAIL = 28, SC_MARKNUM_FOLDERSUB = 29, SC_MARKNUM_FOLDER = 30, SC_MARKNUM_FOLDEROPEN = 31, SC_MASK_FOLDERS = 0xfe000000 }; //! This enum defines what can be displayed in a margin. //! //! \sa SCI_GETMARGINTYPEN, SCI_SETMARGINTYPEN enum { //! The margin can display symbols. Note that all margins can display //! symbols. SC_MARGIN_SYMBOL = 0, //! The margin will display line numbers. SC_MARGIN_NUMBER = 1, //! The margin's background color will be set to the default background //! color. SC_MARGIN_BACK = 2, //! The margin's background color will be set to the default foreground //! color. SC_MARGIN_FORE = 3 }; enum { STYLE_DEFAULT = 32, STYLE_LINENUMBER = 33, STYLE_BRACELIGHT = 34, STYLE_BRACEBAD = 35, STYLE_CONTROLCHAR = 36, STYLE_INDENTGUIDE = 37, STYLE_CALLTIP = 38, STYLE_LASTPREDEFINED = 39, STYLE_MAX = 127 }; enum { SC_CHARSET_ANSI = 0, SC_CHARSET_DEFAULT = 1, SC_CHARSET_BALTIC = 186, SC_CHARSET_CHINESEBIG5 = 136, SC_CHARSET_EASTEUROPE = 238, SC_CHARSET_GB2312 = 134, SC_CHARSET_GREEK = 161, SC_CHARSET_HANGUL = 129, SC_CHARSET_MAC = 77, SC_CHARSET_OEM = 255, SC_CHARSET_RUSSIAN = 204, SC_CHARSET_SHIFTJIS = 128, SC_CHARSET_SYMBOL = 2, SC_CHARSET_TURKISH = 162, SC_CHARSET_JOHAB = 130, SC_CHARSET_HEBREW = 177, SC_CHARSET_ARABIC = 178, SC_CHARSET_VIETNAMESE = 163, SC_CHARSET_THAI = 222, SC_CHARSET_8859_15 = 1000 }; enum { SC_CASE_MIXED = 0, SC_CASE_UPPER = 1, SC_CASE_LOWER = 2 }; enum { INDIC_MAX = 31, INDIC_PLAIN = 0, INDIC_SQUIGGLE = 1, INDIC_TT = 2, INDIC_DIAGONAL = 3, INDIC_STRIKE = 4, INDIC_HIDDEN = 5, INDIC_BOX = 6, INDIC_ROUNDBOX = 7, INDIC_CONTAINER = 8, INDIC0_MASK = 0x20, INDIC1_MASK = 0x40, INDIC2_MASK = 0x80, INDICS_MASK = 0xe0 }; enum { SC_PRINT_NORMAL = 0, SC_PRINT_INVERTLIGHT = 1, SC_PRINT_BLACKONWHITE = 2, SC_PRINT_COLOURONWHITE = 3, SC_PRINT_COLOURONWHITEDEFAULTBG = 4 }; enum { SCFIND_WHOLEWORD = 2, SCFIND_MATCHCASE = 4, SCFIND_WORDSTART = 0x00100000, SCFIND_REGEXP = 0x00200000, SCFIND_POSIX = 0x00400000 }; enum { SC_FOLDLEVELBASE = 0x00400, SC_FOLDLEVELWHITEFLAG = 0x01000, SC_FOLDLEVELHEADERFLAG = 0x02000, SC_FOLDLEVELBOXHEADERFLAG = 0x04000, SC_FOLDLEVELBOXFOOTERFLAG = 0x08000, SC_FOLDLEVELCONTRACTED = 0x10000, SC_FOLDLEVELUNINDENT = 0x20000, SC_FOLDLEVELNUMBERMASK = 0x00fff }; enum { SC_FOLDFLAG_BOX = 0x0001, SC_FOLDFLAG_LINEBEFORE_EXPANDED = 0x0002, SC_FOLDFLAG_LINEBEFORE_CONTRACTED = 0x0004, SC_FOLDFLAG_LINEAFTER_EXPANDED = 0x0008, SC_FOLDFLAG_LINEAFTER_CONTRACTED = 0x0010, SC_FOLDFLAG_LEVELNUMBERS = 0x0040 }; enum { SC_TIME_FOREVER = 10000000 }; enum { SC_WRAP_NONE = 0, SC_WRAP_WORD = 1, SC_WRAP_CHAR = 2 }; enum { SC_CACHE_NONE = 0, SC_CACHE_CARET = 1, SC_CACHE_PAGE = 2, SC_CACHE_DOCUMENT = 3 }; enum { EDGE_NONE = 0, EDGE_LINE = 1, EDGE_BACKGROUND = 2 }; enum { SC_CURSORNORMAL = -1, SC_CURSORWAIT = 4 }; enum { VISIBLE_SLOP = 0x01, VISIBLE_STRICT = 0x04 }; enum { CARET_SLOP = 0x01, CARET_STRICT = 0x04, CARET_JUMPS = 0x10, CARET_EVEN = 0x08 }; enum { CARETSTYLE_INVISIBLE = 0, CARETSTYLE_LINE = 1, CARETSTYLE_BLOCK = 2 }; enum { SC_MOD_INSERTTEXT = 0x1, SC_MOD_DELETETEXT = 0x2, SC_MOD_CHANGESTYLE = 0x4, SC_MOD_CHANGEFOLD = 0x8, SC_PERFORMED_USER = 0x10, SC_PERFORMED_UNDO = 0x20, SC_PERFORMED_REDO = 0x40, SC_MULTISTEPUNDOREDO = 0x80, SC_LASTSTEPINUNDOREDO = 0x100, SC_MOD_CHANGEMARKER = 0x200, SC_MOD_BEFOREINSERT = 0x400, SC_MOD_BEFOREDELETE = 0x800, SC_MULTILINEUNDOREDO = 0x1000, SC_STARTACTION = 0x2000, SC_MOD_CHANGEINDICATOR = 0x4000, SC_MODEVENTMASKALL = 0x6fff }; enum { SCK_DOWN = 300, SCK_UP = 301, SCK_LEFT = 302, SCK_RIGHT = 303, SCK_HOME = 304, SCK_END = 305, SCK_PRIOR = 306, SCK_NEXT = 307, SCK_DELETE = 308, SCK_INSERT = 309, SCK_ESCAPE = 7, SCK_BACK = 8, SCK_TAB = 9, SCK_RETURN = 13, SCK_ADD = 310, SCK_SUBTRACT = 311, SCK_DIVIDE = 312, SCK_WIN = 313, SCK_RWIN = 314, SCK_MENU = 315 }; //! This enum defines the different modifier keys. enum { //! No modifier key. SCMOD_NORM = 0, //! Shift key. SCMOD_SHIFT = 1, //! Control key. SCMOD_CTRL = 2, //! Alt key. SCMOD_ALT = 4 }; //! This enum defines the different language lexers. //! //! \sa SCI_GETLEXER, SCI_SETLEXER enum { //! No lexer is selected and the SCN_STYLENEEDED signal is emitted so //! that the application can style the text as needed. This is the //! default. SCLEX_CONTAINER = 0, //! Select the null lexer that does no syntax styling. SCLEX_NULL = 1, //! Select the Python lexer. SCLEX_PYTHON = 2, //! Select the C++ lexer. SCLEX_CPP = 3, //! Select the HTML lexer. SCLEX_HTML = 4, //! Select the XML lexer. SCLEX_XML = 5, //! Select the Perl lexer. SCLEX_PERL = 6, //! Select the SQL lexer. SCLEX_SQL = 7, //! Select the Visual Basic lexer. SCLEX_VB = 8, //! Select the lexer for properties style files. SCLEX_PROPERTIES = 9, //! Select the lexer for error list style files. SCLEX_ERRORLIST = 10, //! Select the Makefile lexer. SCLEX_MAKEFILE = 11, //! Select the Windows batch file lexer. SCLEX_BATCH = 12, //! Select the LaTex lexer. SCLEX_LATEX = 14, //! Select the Lua lexer. SCLEX_LUA = 15, //! Select the lexer for diff output. SCLEX_DIFF = 16, //! Select the lexer for Apache configuration files. SCLEX_CONF = 17, //! Select the Pascal lexer. SCLEX_PASCAL = 18, //! Select the Avenue lexer. SCLEX_AVE = 19, //! Select the Ada lexer. SCLEX_ADA = 20, //! Select the Lisp lexer. SCLEX_LISP = 21, //! Select the Ruby lexer. SCLEX_RUBY = 22, //! Select the Eiffel lexer. SCLEX_EIFFEL = 23, //! Select the Eiffel lexer folding at keywords. SCLEX_EIFFELKW = 24, //! Select the Tcl lexer. SCLEX_TCL = 25, //! Select the lexer for nnCron files. SCLEX_NNCRONTAB = 26, //! Select the Bullant lexer. SCLEX_BULLANT = 27, //! Select the VBScript lexer. SCLEX_VBSCRIPT = 28, //! Select the ASP lexer. SCLEX_ASP = SCLEX_HTML, //! Select the PHP lexer. SCLEX_PHP = SCLEX_HTML, //! Select the Baan lexer. SCLEX_BAAN = 31, //! Select the Matlab lexer. SCLEX_MATLAB = 32, //! Select the Scriptol lexer. SCLEX_SCRIPTOL = 33, //! Select the assembler lexer. SCLEX_ASM = 34, //! Select the C++ lexer with case insensitive keywords. SCLEX_CPPNOCASE = 35, //! Select the FORTRAN lexer. SCLEX_FORTRAN = 36, //! Select the FORTRAN77 lexer. SCLEX_F77 = 37, //! Select the CSS lexer. SCLEX_CSS = 38, //! Select the POV lexer. SCLEX_POV = 39, //! Select the Basser Lout typesetting language lexer. SCLEX_LOUT = 40, //! Select the EScript lexer. SCLEX_ESCRIPT = 41, //! Select the PostScript lexer. SCLEX_PS = 42, //! Select the NSIS lexer. SCLEX_NSIS = 43, //! Select the MMIX assembly language lexer. SCLEX_MMIXAL = 44, //! Select the Clarion lexer. SCLEX_CLW = 45, //! Select the Clarion lexer with case insensitive keywords. SCLEX_CLWNOCASE = 46, //! Select the MPT text log file lexer. SCLEX_LOT = 47, //! Select the YAML lexer. SCLEX_YAML = 48, //! Select the TeX lexer. SCLEX_TEX = 49, //! Select the Metapost lexer. SCLEX_METAPOST = 50, //! Select the PowerBASIC lexer. SCLEX_POWERBASIC = 51, //! Select the Forth lexer. SCLEX_FORTH = 52, //! Select the Erlang lexer. SCLEX_ERLANG = 53, //! Select the Octave lexer. SCLEX_OCTAVE = 54, //! Select the MS SQL lexer. SCLEX_MSSQL = 55, //! Select the Verilog lexer. SCLEX_VERILOG = 56, //! Select the KIX-Scripts lexer. SCLEX_KIX = 57, //! Select the Gui4Cli lexer. SCLEX_GUI4CLI = 58, //! Select the Specman E lexer. SCLEX_SPECMAN = 59, //! Select the AutoIt3 lexer. SCLEX_AU3 = 60, //! Select the APDL lexer. SCLEX_APDL = 61, //! Select the Bash lexer. SCLEX_BASH = 62, //! Select the ASN.1 lexer. SCLEX_ASN1 = 63, //! Select the VHDL lexer. SCLEX_VHDL = 64, //! Select the Caml lexer. SCLEX_CAML = 65, //! Select the BlitzBasic lexer. SCLEX_BLITZBASIC = 66, //! Select the PureBasic lexer. SCLEX_PUREBASIC = 67, //! Select the Haskell lexer. SCLEX_HASKELL = 68, //! Select the PHPScript lexer. SCLEX_PHPSCRIPT = 69, //! Select the TADS3 lexer. SCLEX_TADS3 = 70, //! Select the REBOL lexer. SCLEX_REBOL = 71, //! Select the Smalltalk lexer. SCLEX_SMALLTALK = 72, //! Select the FlagShip lexer. SCLEX_FLAGSHIP = 73, //! Select the Csound lexer. SCLEX_CSOUND = 74, //! Select the FreeBasic lexer. SCLEX_FREEBASIC = 75, //! Select the InnoSetup lexer. SCLEX_INNOSETUP = 76, //! Select the Opal lexer. SCLEX_OPAL = 77, //! Select the Spice lexer. SCLEX_SPICE = 78, //! Select the D lexer. SCLEX_D = 79, //! Select the CMake lexer. SCLEX_CMAKE = 80, //! Select the GAP lexer. SCLEX_GAP = 81, //! Select the PLM lexer. SCLEX_PLM = 82, //! Select the Progress lexer. SCLEX_PROGRESS = 83 }; //! Construct an empty QsciScintillaBase with parent \a parent. explicit QsciScintillaBase(QWidget *parent = 0); //! Destroys the QsciScintillaBase instance. virtual ~QsciScintillaBase(); //! Returns a pointer to a QsciScintillaBase instance, or 0 if there isn't //! one. This can be used by the higher level API to send messages that //! aren't associated with a particular instance. static QsciScintillaBase *pool(); //! Send the Scintilla message \a msg with the optional parameters \a //! wParam and \a lParam. long SendScintilla(unsigned int msg, unsigned long wParam = 0, long lParam = 0) const; //! \overload long SendScintilla(unsigned int msg, unsigned long wParam, const char *lParam) const { return SendScintilla(msg, wParam, reinterpret_cast(lParam)); } //! \overload long SendScintilla(unsigned int msg, const char *lParam) const { return SendScintilla(msg, 0UL, reinterpret_cast(lParam)); } //! \overload long SendScintilla(unsigned int msg, const char *wParam, const char *lParam) const { return SendScintilla(msg, reinterpret_cast(wParam), reinterpret_cast(lParam)); } //! \overload long SendScintilla(unsigned int msg, long wParam) const { return SendScintilla(msg, static_cast(wParam), 0L); } //! \overload long SendScintilla(unsigned int msg, int wParam) const { return SendScintilla(msg, static_cast(wParam), 0L); } //! \overload long SendScintilla(unsigned int msg, long cpMin, long cpMax, char *lpstrText) const; //! \overload long SendScintilla(unsigned int msg, unsigned long wParam, const QColor &col) const; //! \overload long SendScintilla(unsigned int msg, const QColor &col) const; //! \overload long SendScintilla(unsigned int msg, unsigned long wParam, QPainter *hdc, const QRect &rc, long cpMin, long cpMax) const; //! \overload long SendScintilla(unsigned int msg, unsigned long wParam, const QPixmap &lParam) const { return SendScintilla(msg, wParam, reinterpret_cast(&lParam)); } signals: //! This signal is emitted when text is selected or de-selected. //! \a yes is true if text has been selected and false if text has been //! deselected. void QSCN_SELCHANGED(bool yes); //! This signal is emitted when the user selects an item in an //! auto-completion list. It is emitted before the selection is inserted. //! The insertion can be cancelled by sending an SCI_AUTOCANCEL message //! from a connected slot. //! \a selection is the text of the selection. //! \a position is the start position of the word being completed. void SCN_AUTOCSELECTION(const char *selection, int position); //! This signal is emitted when the document has changed for any reason. void SCEN_CHANGE(); //! This signal ir emitted when the user clicks on a calltip. //! \a direction is 1 if the user clicked on the up arrow, 2 if the user //! clicked on the down arrow, and 0 if the user clicked elsewhere. void SCN_CALLTIPCLICK(int direction); //! This signal is emitted whenever the user enters an ordinary character //! into the text. //! \a charadded is the character. It can be used to decide to display a //! call tip or an auto-completion list. void SCN_CHARADDED(int charadded); //! This signal is emitted when the user double clicks. //! \a position is the position in the text where the click occured. //! \a line is the number of the line in the text where the click occured. //! \a modifiers is the logical or of the modifier keys that were pressed //! when the user double clicked. void SCN_DOUBLECLICK(int position, int line, int modifiers); //! void SCN_DWELLEND(int, int, int); //! void SCN_DWELLSTART(int, int, int); //! This signal is emitted when the user clicks on text in a style with the //! hotspot attribute set. //! \a position is the position in the text where the click occured. //! \a modifiers is the logical or of the modifier keys that were pressed //! when the user clicked. void SCN_HOTSPOTCLICK(int position, int modifiers); //! This signal is emitted when the user double clicks on text in a style //! with the hotspot attribute set. //! \a position is the position in the text where the double click occured. //! \a modifiers is the logical or of the modifier keys that were pressed //! when the user double clicked. void SCN_HOTSPOTDOUBLECLICK(int position, int modifiers); //! This signal is emitted when the user clicks on text that has an //! indicator. //! \a position is the position in the text where the click occured. //! \a modifiers is the logical or of the modifier keys that were pressed //! when the user clicked. void SCN_INDICATORCLICK(int position, int modifiers); //! This signal is emitted when the user releases the mouse button on text //! that has an indicator. //! \a position is the position in the text where the release occured. //! \a modifiers is the logical or of the modifier keys that were pressed //! when the user released. void SCN_INDICATORRELEASE(int position, int modifiers); //! This signal is emitted when a recordable editor command has been //! executed. void SCN_MACRORECORD(unsigned int, unsigned long, long); //! This signal is emitted when the user clicks on a sensitive margin. //! \a position is the position of the start of the line against which the //! user clicked. //! \a modifiers is the logical or of the modifier keys that were pressed //! when the user clicked. //! \a margin is the number of the margin the user clicked in: 0, 1 or 2. //! //! \sa SCI_GETMARGINSENSITIVEN, SCI_SETMARGINSENSITIVEN void SCN_MARGINCLICK(int position, int modifiers, int margin); //! void SCN_MODIFIED(int, int, const char *, int, int, int, int, int); //! This signal is emitted when the user attempts to modify read-only //! text. void SCN_MODIFYATTEMPTRO(); //! void SCN_NEEDSHOWN(int, int); //! This signal is emitted when painting has been completed. It is useful //! to trigger some other change but to have the paint be done first to //! appear more reponsive to the user. void SCN_PAINTED(); //! This signal is emitted when the current state of the text no longer //! corresponds to the state of the text at the save point. //! //! \sa SCI_SETSAVEPOINT, SCN_SAVEPOINTREACHED() void SCN_SAVEPOINTLEFT(); //! This signal is emitted when the current state of the text corresponds //! to the state of the text at the save point. This allows feedback to be //! given to the user as to whether the text has been modified since it was //! last saved. //! //! \sa SCI_SETSAVEPOINT, SCN_SAVEPOINTLEFT() void SCN_SAVEPOINTREACHED(); //! This signal is emitted when a range of text needs to be syntax styled. //! The range is from the value returned by the SCI_GETENDSTYLED message //! and \a position. It is only emitted if the currently selected lexer is //! SCNLEX_CONTAINER. //! //! \sa SCI_COLOURISE, SCI_GETENDSTYLED void SCN_STYLENEEDED(int position); //! void SCN_UPDATEUI(); //! void SCN_USERLISTSELECTION(const char *, int); //! void SCN_ZOOM(); protected: //! Re-implemented to handle the context menu. virtual void contextMenuEvent(QContextMenuEvent *e); //! Re-implemented to handle drag enters. virtual void dragEnterEvent(QDragEnterEvent *e); //! Re-implemented to handle drag leaves. virtual void dragLeaveEvent(QDragLeaveEvent *e); //! Re-implemented to handle drag moves. virtual void dragMoveEvent(QDragMoveEvent *e); //! Re-implemented to handle drops. virtual void dropEvent(QDropEvent *e); //! Re-implemented to tell Scintilla it has the focus. virtual void focusInEvent(QFocusEvent *e); //! Re-implemented to tell Scintilla it has lost the focus. virtual void focusOutEvent(QFocusEvent *e); //! Re-implemented to allow tabs to be entered as text. virtual bool focusNextPrevChild(bool next); //! Re-implemented to handle key presses. virtual void keyPressEvent(QKeyEvent *e); //! Re-implemented to handle composed characters. virtual void inputMethodEvent(QInputMethodEvent *e); //! Re-implemented to handle mouse double-clicks. virtual void mouseDoubleClickEvent(QMouseEvent *e); //! Re-implemented to handle mouse moves. virtual void mouseMoveEvent(QMouseEvent *e); //! Re-implemented to handle mouse presses. virtual void mousePressEvent(QMouseEvent *e); //! Re-implemented to handle mouse releases. virtual void mouseReleaseEvent(QMouseEvent *e); //! Re-implemented to paint the viewport. virtual void paintEvent(QPaintEvent *e); //! Re-implemented to handle resizes. virtual void resizeEvent(QResizeEvent *e); //! \internal Re-implemented to handle scrolling. virtual void scrollContentsBy(int dx, int dy); private slots: void handleTimer(); void handleVSb(int value); void handleHSb(int value); void handleSelection(); private: // This is needed to allow ScintillaQt to emit this class's signals. friend class ScintillaQt; ScintillaQt *sci; QPoint triple_click_at; QTimer triple_click; QsciScintillaBase(const QsciScintillaBase &); QsciScintillaBase &operator=(const QsciScintillaBase &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscicommandset.h0000644000175000001440000000504211407213302024067 0ustar subzerousers// This defines the interface to the QsciCommandSet class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCICOMMANDSET_H #define QSCICOMMANDSET_H extern "C++" { #include #include #include #include class QSettings; class QsciScintilla; //! \brief The QsciCommandSet class represents the set of all internal editor //! commands that may have keys bound. //! //! Methods are provided to access the individual commands and to read and //! write the current bindings from and to settings files. class QSCINTILLA_EXPORT QsciCommandSet { public: //! The key bindings for each command in the set are read from the //! settings \a qs. \a prefix is prepended to the key of each entry. //! true is returned if there was no error. //! //! \sa writeSettings() bool readSettings(QSettings &qs, const char *prefix = "/Scintilla"); //! The key bindings for each command in the set are written to the //! settings \a qs. \a prefix is prepended to the key of each entry. //! true is returned if there was no error. //! //! \sa readSettings() bool writeSettings(QSettings &qs, const char *prefix = "/Scintilla"); //! The commands in the set are returned as a list. QList &commands() {return cmds;} //! The primary keys bindings for all commands are removed. void clearKeys(); //! The alternate keys bindings for all commands are removed. void clearAlternateKeys(); private: friend class QsciScintilla; QsciCommandSet(QsciScintilla *qs); ~QsciCommandSet(); QsciScintilla *qsci; QList cmds; QsciCommandSet(const QsciCommandSet &); QsciCommandSet &operator=(const QsciCommandSet &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerd.h0000644000175000001440000001530611407213302023224 0ustar subzerousers// This defines the interface to the QsciLexerD class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERD_H #define QSCILEXERD_H extern "C++" { #include #include #include //! \brief The QsciLexerD class encapsulates the Scintilla D lexer. class QSCINTILLA_EXPORT QsciLexerD : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the D //! lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A comment line. CommentLine = 2, //! A JavaDoc and Doxygen comment. CommentDoc = 3, //! A nested comment. CommentNested = 4, //! A number. Number = 5, //! A keyword. Keyword = 6, //! A secondary keyword. KeywordSecondary = 7, //! A doc keyword KeywordDoc = 8, //! Typedefs and aliases Typedefs = 9, //! A string. String = 10, //! The end of a line where a string is not closed. UnclosedString = 11, //! A character Character = 12, //! An operator. Operator = 13, //! An identifier Identifier = 14, //! A JavaDoc and Doxygen line. CommentLineDoc = 15, //! A JavaDoc and Doxygen keyword. CommentDocKeyword = 16, //! A JavaDoc and Doxygen keyword error. CommentDocKeywordError = 17, }; //! Construct a QsciLexerD with parent \a parent. \a parent is typically //! the QsciScintilla instance. QsciLexerD(QObject *parent = 0); //! Destroys the QsciLexerD instance. virtual ~QsciLexerD(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the character sequences that can separate //! auto-completion words. QStringList autoCompletionWordSeparators() const; //! \internal Returns a space separated list of words or characters in a //! particular style that define the end of a block for auto-indentation. //! The styles is returned via \a style. const char *blockEnd(int *style = 0) const; //! \internal Returns a space separated list of words or characters in a //! particular style that define the start of a block for auto-indentation. //! The styles is returned via \a style. const char *blockStart(int *style = 0) const; //! \internal Returns a space separated list of keywords in a particular //! style that define the start of a block for auto-indentation. The //! styles is returned via \a style. const char *blockStartKeyword(int *style = 0) const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised by //! the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the style //! is invalid for this language then an empty QString is returned. This //! is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the propertyChanged() //! signal as required. void refreshProperties(); //! Returns true if "} else {" lines can be folded. //! //! \sa setFoldAtElse() bool foldAtElse() const; //! Returns true if multi-line comment blocks can be folded. //! //! \sa setFoldComments() bool foldComments() const; //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; public slots: //! If \a fold is true then "} else {" lines can be folded. The default is //! false. //! //! \sa foldAtElse() virtual void setFoldAtElse(bool fold); //! If \a fold is true then multi-line comment blocks can be folded. The //! default is false. //! //! \sa foldComments() virtual void setFoldComments(bool fold); //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! //! \sa writeProperties() bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! //! \sa readProperties() bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setAtElseProp(); void setCommentProp(); void setCompactProp(); bool fold_atelse; bool fold_comments; bool fold_compact; QsciLexerD(const QsciLexerD &); QsciLexerD &operator=(const QsciLexerD &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerlua.h0000644000175000001440000001203511407213302023556 0ustar subzerousers// This defines the interface to the QsciLexerLua class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERLUA_H #define QSCILEXERLUA_H extern "C++" { #include #include #include //! \brief The QsciLexerLua class encapsulates the Scintilla Lua //! lexer. class QSCINTILLA_EXPORT QsciLexerLua : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! Lua lexer. enum { //! The default. Default = 0, //! A block comment. Comment = 1, //! A line comment. LineComment = 2, //! A number. Number = 4, //! A keyword. Keyword = 5, //! A string. String = 6, //! A character. Character = 7, //! A literal string. LiteralString = 8, //! Preprocessor Preprocessor = 9, //! An operator. Operator = 10, //! An identifier Identifier = 11, //! The end of a line where a string is not closed. UnclosedString = 12, //! Basic functions. BasicFunctions = 13, //! String, table and maths functions. StringTableMathsFunctions = 14, //! Coroutines, I/O and system facilities. CoroutinesIOSystemFacilities = 15 }; //! Construct a QsciLexerLua with parent \a parent. \a parent is typically //! the QsciScintilla instance. QsciLexerLua(QObject *parent = 0); //! Destroys the QsciLexerLua instance. virtual ~QsciLexerLua(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns a space separated list of words or characters in //! a particular style that define the start of a block for //! auto-indentation. The styles is returned via \a style. const char *blockStart(int *style = 0) const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. void refreshProperties(); //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; public slots: //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCompactProp(); bool fold_compact; QsciLexerLua(const QsciLexerLua &); QsciLexerLua &operator=(const QsciLexerLua &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexercpp.h0000644000175000001440000002015411407213302023560 0ustar subzerousers// This defines the interface to the QsciLexerCPP class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERCPP_H #define QSCILEXERCPP_H extern "C++" { #include #include #include //! \brief The QsciLexerCPP class encapsulates the Scintilla C++ //! lexer. class QSCINTILLA_EXPORT QsciLexerCPP : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! C++ lexer. enum { //! The default. Default = 0, //! A C comment. Comment = 1, //! A C++ comment line. CommentLine = 2, //! A JavaDoc/Doxygen style C comment. CommentDoc = 3, //! A number. Number = 4, //! A keyword. Keyword = 5, //! A double-quoted string. DoubleQuotedString = 6, //! A single-quoted string. SingleQuotedString = 7, //! An IDL UUID. UUID = 8, //! A pre-processor block. PreProcessor = 9, //! An operator. Operator = 10, //! An identifier Identifier = 11, //! The end of a line where a string is not closed. UnclosedString = 12, //! A C# verbatim string. VerbatimString = 13, //! A JavaScript regular expression. Regex = 14, //! A JavaDoc/Doxygen style C++ comment line. CommentLineDoc = 15, //! A keyword defined in keyword set number 2. The class must //! be sub-classed and re-implement keywords() to make use of //! this style. KeywordSet2 = 16, //! A JavaDoc/Doxygen keyword. CommentDocKeyword = 17, //! A JavaDoc/Doxygen keyword error. CommentDocKeywordError = 18, //! A global class or typedef defined in keyword set number 4. //! The class must be sub-classed and re-implement keywords() //! to make use of this style. GlobalClass = 19 }; //! Construct a QsciLexerCPP with parent \a parent. \a parent is typically //! the QsciScintilla instance. \a caseInsensitiveKeywords is true if the //! lexer ignores the case of keywords. QsciLexerCPP(QObject *parent = 0, bool caseInsensitiveKeywords = false); //! Destroys the QsciLexerCPP instance. virtual ~QsciLexerCPP(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the character sequences that can separate //! auto-completion words. QStringList autoCompletionWordSeparators() const; //! \internal Returns a space separated list of words or characters in //! a particular style that define the end of a block for //! auto-indentation. The styles is returned via \a style. const char *blockEnd(int *style = 0) const; //! \internal Returns a space separated list of words or characters in //! a particular style that define the start of a block for //! auto-indentation. The styles is returned via \a style. const char *blockStart(int *style = 0) const; //! \internal Returns a space separated list of keywords in a //! particular style that define the start of a block for //! auto-indentation. The styles is returned via \a style. const char *blockStartKeyword(int *style = 0) const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. void refreshProperties(); //! Returns true if "} else {" lines can be folded. //! //! \sa setFoldAtElse() bool foldAtElse() const; //! Returns true if multi-line comment blocks can be folded. //! //! \sa setFoldComments() bool foldComments() const; //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; //! Returns true if preprocessor blocks can be folded. //! //! \sa setFoldPreprocessor() bool foldPreprocessor() const; //! Returns true if preprocessor lines (after the preprocessor //! directive) are styled. //! //! \sa setStylePreprocessor() bool stylePreprocessor() const; public slots: //! If \a fold is true then "} else {" lines can be folded. The //! default is false. //! //! \sa foldAtElse() virtual void setFoldAtElse(bool fold); //! If \a fold is true then multi-line comment blocks can be folded. //! The default is false. //! //! \sa foldComments() virtual void setFoldComments(bool fold); //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); //! If \a fold is true then preprocessor blocks can be folded. The //! default is true. //! //! \sa foldPreprocessor() virtual void setFoldPreprocessor(bool fold); //! If \a style is true then preprocessor lines (after the preprocessor //! directive) are styled. The default is false. //! //! \sa stylePreprocessor() virtual void setStylePreprocessor(bool style); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! //! \sa writeProperties() bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! //! \sa readProperties() bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setAtElseProp(); void setCommentProp(); void setCompactProp(); void setPreprocProp(); void setStylePreprocProp(); bool fold_atelse; bool fold_comments; bool fold_compact; bool fold_preproc; bool style_preproc; bool nocase; QsciLexerCPP(const QsciLexerCPP &); QsciLexerCPP &operator=(const QsciLexerCPP &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerhtml.h0000644000175000001440000003075411407213302023751 0ustar subzerousers// This defines the interface to the QsciLexerHTML class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERHTML_H #define QSCILEXERHTML_H extern "C++" { #include #include #include //! \brief The QsciLexerHTML class encapsulates the Scintilla HTML lexer. class QSCINTILLA_EXPORT QsciLexerHTML : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! HTML lexer. enum { //! The default. Default = 0, //! A tag. Tag = 1, //! An unknown tag. UnknownTag = 2, //! An attribute. Attribute = 3, //! An unknown attribute. UnknownAttribute = 4, //! An HTML number. HTMLNumber = 5, //! An HTML double-quoted string. HTMLDoubleQuotedString = 6, //! An HTML single-quoted string. HTMLSingleQuotedString = 7, //! Other text within a tag. OtherInTag = 8, //! An HTML comment. HTMLComment = 9, //! An entity. Entity = 10, //! The end of an XML style tag. XMLTagEnd = 11, //! The start of an XML fragment. XMLStart = 12, //! The end of an XML fragment. XMLEnd = 13, //! A script tag. Script = 14, //! The start of an ASP fragment with @. ASPAtStart = 15, //! The start of an ASP fragment. ASPStart = 16, //! CDATA. CDATA = 17, //! The start of a PHP fragment. PHPStart = 18, //! An unquoted HTML value. HTMLValue = 19, //! An ASP X-Code comment. ASPXCComment = 20, //! The default for SGML. SGMLDefault = 21, //! An SGML command. SGMLCommand = 22, //! The first parameter of an SGML command. SGMLParameter = 23, //! An SGML double-quoted string. SGMLDoubleQuotedString = 24, //! An SGML single-quoted string. SGMLSingleQuotedString = 25, //! An SGML error. SGMLError = 26, //! An SGML special entity. SGMLSpecial = 27, //! An SGML entity. SGMLEntity = 28, //! An SGML comment. SGMLComment = 29, //! A comment with the first parameter of an SGML command. SGMLParameterComment = 30, //! The default for an SGML block. SGMLBlockDefault = 31, //! The start of a JavaScript fragment. JavaScriptStart = 40, //! The default for JavaScript. JavaScriptDefault = 41, //! A JavaScript comment. JavaScriptComment = 42, //! A JavaScript line comment. JavaScriptCommentLine = 43, //! A JavaDoc style JavaScript comment. JavaScriptCommentDoc = 44, //! A JavaScript number. JavaScriptNumber = 45, //! A JavaScript word. JavaScriptWord = 46, //! A JavaScript keyword. JavaScriptKeyword = 47, //! A JavaScript double-quoted string. JavaScriptDoubleQuotedString = 48, //! A JavaScript single-quoted string. JavaScriptSingleQuotedString = 49, //! A JavaScript symbol. JavaScriptSymbol = 50, //! The end of a JavaScript line where a string is not closed. JavaScriptUnclosedString = 51, //! A JavaScript regular expression. JavaScriptRegex = 52, //! The start of an ASP JavaScript fragment. ASPJavaScriptStart = 55, //! The default for ASP JavaScript. ASPJavaScriptDefault = 56, //! An ASP JavaScript comment. ASPJavaScriptComment = 57, //! An ASP JavaScript line comment. ASPJavaScriptCommentLine = 58, //! An ASP JavaDoc style JavaScript comment. ASPJavaScriptCommentDoc = 59, //! An ASP JavaScript number. ASPJavaScriptNumber = 60, //! An ASP JavaScript word. ASPJavaScriptWord = 61, //! An ASP JavaScript keyword. ASPJavaScriptKeyword = 62, //! An ASP JavaScript double-quoted string. ASPJavaScriptDoubleQuotedString = 63, //! An ASP JavaScript single-quoted string. ASPJavaScriptSingleQuotedString = 64, //! An ASP JavaScript symbol. ASPJavaScriptSymbol = 65, //! The end of an ASP JavaScript line where a string is not //! closed. ASPJavaScriptUnclosedString = 66, //! An ASP JavaScript regular expression. ASPJavaScriptRegex = 67, //! The start of a VBScript fragment. VBScriptStart = 70, //! The default for VBScript. VBScriptDefault = 71, //! A VBScript comment. VBScriptComment = 72, //! A VBScript number. VBScriptNumber = 73, //! A VBScript keyword. VBScriptKeyword = 74, //! A VBScript string. VBScriptString = 75, //! A VBScript identifier. VBScriptIdentifier = 76, //! The end of a VBScript line where a string is not closed. VBScriptUnclosedString = 77, //! The start of an ASP VBScript fragment. ASPVBScriptStart = 80, //! The default for ASP VBScript. ASPVBScriptDefault = 81, //! An ASP VBScript comment. ASPVBScriptComment = 82, //! An ASP VBScript number. ASPVBScriptNumber = 83, //! An ASP VBScript keyword. ASPVBScriptKeyword = 84, //! An ASP VBScript string. ASPVBScriptString = 85, //! An ASP VBScript identifier. ASPVBScriptIdentifier = 86, //! The end of an ASP VBScript line where a string is not //! closed. ASPVBScriptUnclosedString = 87, //! The start of a Python fragment. PythonStart = 90, //! The default for Python. PythonDefault = 91, //! A Python comment. PythonComment = 92, //! A Python number. PythonNumber = 93, //! A Python double-quoted string. PythonDoubleQuotedString = 94, //! A Python single-quoted string. PythonSingleQuotedString = 95, //! A Python keyword. PythonKeyword = 96, //! A Python triple single-quoted string. PythonTripleSingleQuotedString = 97, //! A Python triple double-quoted string. PythonTripleDoubleQuotedString = 98, //! The name of a Python class. PythonClassName = 99, //! The name of a Python function or method. PythonFunctionMethodName = 100, //! A Python operator. PythonOperator = 101, //! A Python identifier. PythonIdentifier = 102, //! The start of an ASP Python fragment. ASPPythonStart = 105, //! The default for ASP Python. ASPPythonDefault = 106, //! An ASP Python comment. ASPPythonComment = 107, //! An ASP Python number. ASPPythonNumber = 108, //! An ASP Python double-quoted string. ASPPythonDoubleQuotedString = 109, //! An ASP Python single-quoted string. ASPPythonSingleQuotedString = 110, //! An ASP Python keyword. ASPPythonKeyword = 111, //! An ASP Python triple single-quoted string. ASPPythonTripleSingleQuotedString = 112, //! An ASP Python triple double-quoted string. ASPPythonTripleDoubleQuotedString = 113, //! The name of an ASP Python class. ASPPythonClassName = 114, //! The name of an ASP Python function or method. ASPPythonFunctionMethodName = 115, //! An ASP Python operator. ASPPythonOperator = 116, //! An ASP Python identifier ASPPythonIdentifier = 117, //! The default for PHP. PHPDefault = 118, //! A PHP double-quoted string. PHPDoubleQuotedString = 119, //! A PHP single-quoted string. PHPSingleQuotedString = 120, //! A PHP keyword. PHPKeyword = 121, //! A PHP number. PHPNumber = 122, //! A PHP variable. PHPVariable = 123, //! A PHP comment. PHPComment = 124, //! A PHP line comment. PHPCommentLine = 125, //! A PHP double-quoted variable. PHPDoubleQuotedVariable = 126, //! A PHP operator. PHPOperator = 127 }; //! Construct a QsciLexerHTML with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerHTML(QObject *parent = 0); //! Destroys the QsciLexerHTML instance. virtual ~QsciLexerHTML(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. void refreshProperties(); //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; //! Returns true if preprocessor blocks can be folded. //! //! \sa setFoldPreprocessor() bool foldPreprocessor() const; //! Returns true if tags are case sensitive. //! //! \sa setCaseSensitiveTags() bool caseSensitiveTags() const; public slots: //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); //! If \a fold is true then preprocessor blocks can be folded. The //! default is false. //! //! \sa foldPreprocessor() virtual void setFoldPreprocessor(bool fold); //! If \a sens is true then tags are case sensitive. The default is false. //! //! \sa caseSensitiveTags() virtual void setCaseSensitiveTags(bool sens); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCompactProp(); void setPreprocProp(); void setCaseSensTagsProp(); bool fold_compact; bool fold_preproc; bool case_sens_tags; QsciLexerHTML(const QsciLexerHTML &); QsciLexerHTML &operator=(const QsciLexerHTML &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexerperl.h0000644000175000001440000001373611407213302023750 0ustar subzerousers// This defines the interface to the QsciLexerPerl class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERPERL_H #define QSCILEXERPERL_H extern "C++" { #include #include #include //! \brief The QsciLexerPerl class encapsulates the Scintilla Perl //! lexer. class QSCINTILLA_EXPORT QsciLexerPerl : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! Perl lexer. enum { //! The default. Default = 0, //! An error. Error = 1, //! A comment. Comment = 2, //! A POD. POD = 3, //! A number. Number = 4, //! A keyword. Keyword = 5, //! A double-quoted string. DoubleQuotedString = 6, //! A single-quoted string. SingleQuotedString = 7, //! An operator. Operator = 10, //! An identifier Identifier = 11, //! A scalar. Scalar = 12, //! An array. Array = 13, //! A hash. Hash = 14, //! A symbol table. SymbolTable = 15, //! A regular expression. Regex = 17, //! A substitution. Substitution = 18, //! Backticks. Backticks = 20, //! A data section. DataSection = 21, //! A here document delimiter. HereDocumentDelimiter = 22, //! A single quoted here document. SingleQuotedHereDocument = 23, //! A double quoted here document. DoubleQuotedHereDocument = 24, //! A backtick here document. BacktickHereDocument = 25, //! A quoted string (q). QuotedStringQ = 26, //! A quoted string (qq). QuotedStringQQ = 27, //! A quoted string (qx). QuotedStringQX = 28, //! A quoted string (qr). QuotedStringQR = 29, //! A quoted string (qw). QuotedStringQW = 30, //! A verbatim POD. PODVerbatim = 31 }; //! Construct a QsciLexerPerl with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerPerl(QObject *parent = 0); //! Destroys the QsciLexerPerl instance. virtual ~QsciLexerPerl(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! \internal Returns the string of characters that comprise a word. const char *wordCharacters() const; //! Returns the foreground colour of the text for style number //! \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the //! propertyChanged() signal as required. void refreshProperties(); //! Returns true if multi-line comment blocks can be folded. //! //! \sa setFoldComments() bool foldComments() const; //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; public slots: //! If \a fold is true then multi-line comment blocks can be folded. //! The default is false. //! //! \sa foldComments() virtual void setFoldComments(bool fold); //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCommentProp(); void setCompactProp(); bool fold_comments; bool fold_compact; QsciLexerPerl(const QsciLexerPerl &); QsciLexerPerl &operator=(const QsciLexerPerl &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/Qsci/qscilexervhdl.h0000644000175000001440000001440411407213302023734 0ustar subzerousers// This defines the interface to the QsciLexerVHDL class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QSCILEXERVHDL_H #define QSCILEXERVHDL_H extern "C++" { #include #include #include //! \brief The QsciLexerVHDL class encapsulates the Scintilla VHDL lexer. class QSCINTILLA_EXPORT QsciLexerVHDL : public QsciLexer { Q_OBJECT public: //! This enum defines the meanings of the different styles used by the //! VHDL lexer. enum { //! The default. Default = 0, //! A comment. Comment = 1, //! A comment line. CommentLine = 2, //! A number. Number = 3, //! A string. String = 4, //! An operator. Operator = 5, //! An identifier Identifier = 6, //! The end of a line where a string is not closed. UnclosedString = 7, //! A keyword. Keyword = 8, //! A standard operator. StandardOperator = 9, //! An attribute. Attribute = 10, //! A standard function. StandardFunction = 11, //! A standard package. StandardPackage = 12, //! A standard type. StandardType = 13, //! A keyword defined in keyword set number 7. The class must be //! sub-classed and re-implement keywords() to make use of this style. KeywordSet7 = 14 }; //! Construct a QsciLexerVHDL with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerVHDL(QObject *parent = 0); //! Destroys the QsciLexerVHDL instance. virtual ~QsciLexerVHDL(); //! Returns the name of the language. const char *language() const; //! Returns the name of the lexer. Some lexers support a number of //! languages. const char *lexer() const; //! \internal Returns the style used for braces for brace matching. int braceStyle() const; //! Returns the foreground colour of the text for style number \a style. //! //! \sa defaultPaper() QColor defaultColor(int style) const; //! Returns the end-of-line fill for style number \a style. bool defaultEolFill(int style) const; //! Returns the font for style number \a style. QFont defaultFont(int style) const; //! Returns the background colour of the text for style number \a style. //! //! \sa defaultColor() QColor defaultPaper(int style) const; //! Returns the set of keywords for the keyword set \a set recognised //! by the lexer as a space separated string. const char *keywords(int set) const; //! Returns the descriptive name for style number \a style. If the //! style is invalid for this language then an empty QString is returned. //! This is intended to be used in user preference dialogs. QString description(int style) const; //! Causes all properties to be refreshed by emitting the propertyChanged() //! signal as required. void refreshProperties(); //! Returns true if multi-line comment blocks can be folded. //! //! \sa setFoldComments() bool foldComments() const; //! Returns true if trailing blank lines are included in a fold block. //! //! \sa setFoldCompact() bool foldCompact() const; //! Returns true if else blocks can be folded. //! //! \sa setFoldAtElse() bool foldAtElse() const; //! Returns true if begin blocks can be folded. //! //! \sa setFoldAtBegin() bool foldAtBegin() const; //! Returns true if blocks can be folded at a parenthesis. //! //! \sa setFoldAtParenthesis() bool foldAtParenthesis() const; public slots: //! If \a fold is true then multi-line comment blocks can be folded. //! The default is true. //! //! \sa foldComments() virtual void setFoldComments(bool fold); //! If \a fold is true then trailing blank lines are included in a fold //! block. The default is true. //! //! \sa foldCompact() virtual void setFoldCompact(bool fold); //! If \a fold is true then else blocks can be folded. The default is //! true. //! //! \sa foldAtElse() virtual void setFoldAtElse(bool fold); //! If \a fold is true then begin blocks can be folded. The default is //! true. //! //! \sa foldAtBegin() virtual void setFoldAtBegin(bool fold); //! If \a fold is true then blocks can be folded at a parenthesis. The //! default is true. //! //! \sa foldAtParenthesis() virtual void setFoldAtParenthesis(bool fold); protected: //! The lexer's properties are read from the settings \a qs. \a prefix //! (which has a trailing '/') should be used as a prefix to the key of //! each setting. true is returned if there is no error. //! bool readProperties(QSettings &qs,const QString &prefix); //! The lexer's properties are written to the settings \a qs. //! \a prefix (which has a trailing '/') should be used as a prefix to //! the key of each setting. true is returned if there is no error. //! bool writeProperties(QSettings &qs,const QString &prefix) const; private: void setCommentProp(); void setCompactProp(); void setAtElseProp(); void setAtBeginProp(); void setAtParenthProp(); bool fold_comments; bool fold_compact; bool fold_atelse; bool fold_atbegin; bool fold_atparenth; QsciLexerVHDL(const QsciLexerVHDL &); QsciLexerVHDL &operator=(const QsciLexerVHDL &); }; } #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerpython.cpp0000644000175000001440000002000311407213302023744 0ustar subzerousers// This module implements the QsciLexerPython class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerpython.h" #include #include #include // The list of Python keywords that can be used by other friendly lexers. const char *QsciLexerPython::keywordClass = "and assert break class continue def del elif else except exec " "finally for from global if import in is lambda None not or pass " "print raise return try while yield"; // The ctor. QsciLexerPython::QsciLexerPython(QObject *parent) : QsciLexer(parent), fold_comments(false), fold_quotes(false), indent_warn(NoWarning) { } // The dtor. QsciLexerPython::~QsciLexerPython() { } // Returns the language name. const char *QsciLexerPython::language() const { return "Python"; } // Returns the lexer name. const char *QsciLexerPython::lexer() const { return "python"; } // Return the set of character sequences that can separate auto-completion // words. QStringList QsciLexerPython::autoCompletionWordSeparators() const { QStringList wl; wl << "."; return wl; } // Return the list of characters that can start a block. const char *QsciLexerPython::blockStart(int *style) const { if (style) *style = Operator; return ":"; } // Return the number of lines to look back when auto-indenting. int QsciLexerPython::blockLookback() const { // This must be 0 otherwise de-indenting a Python block gets very // difficult. return 0; } // Return the style used for braces. int QsciLexerPython::braceStyle() const { return Operator; } // Returns the foreground colour of the text for a style. QColor QsciLexerPython::defaultColor(int style) const { switch (style) { case Default: return QColor(0x80,0x80,0x80); case Comment: return QColor(0x00,0x7f,0x00); case Number: return QColor(0x00,0x7f,0x7f); case DoubleQuotedString: case SingleQuotedString: return QColor(0x7f,0x00,0x7f); case Keyword: return QColor(0x00,0x00,0x7f); case TripleSingleQuotedString: case TripleDoubleQuotedString: return QColor(0x7f,0x00,0x00); case ClassName: return QColor(0x00,0x00,0xff); case FunctionMethodName: return QColor(0x00,0x7f,0x7f); case Operator: case Identifier: break; case CommentBlock: return QColor(0x7f,0x7f,0x7f); case UnclosedString: return QColor(0x00,0x00,0x00); case HighlightedIdentifier: return QColor(0x40,0x70,0x90); case Decorator: return QColor(0x80,0x50,0x00); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerPython::defaultEolFill(int style) const { if (style == UnclosedString) return true; return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerPython::defaultFont(int style) const { QFont f; switch (style) { case Comment: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case DoubleQuotedString: case SingleQuotedString: case UnclosedString: #if defined(Q_OS_WIN) f = QFont("Courier New",10); #else f = QFont("Bitstream Vera Sans Mono",9); #endif break; case Keyword: case ClassName: case FunctionMethodName: case Operator: f = QsciLexer::defaultFont(style); f.setBold(true); break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerPython::keywords(int set) const { if (set != 1) return 0; return keywordClass; } // Returns the user name of a style. QString QsciLexerPython::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case Number: return tr("Number"); case DoubleQuotedString: return tr("Double-quoted string"); case SingleQuotedString: return tr("Single-quoted string"); case Keyword: return tr("Keyword"); case TripleSingleQuotedString: return tr("Triple single-quoted string"); case TripleDoubleQuotedString: return tr("Triple double-quoted string"); case ClassName: return tr("Class name"); case FunctionMethodName: return tr("Function or method name"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case CommentBlock: return tr("Comment block"); case UnclosedString: return tr("Unclosed string"); case HighlightedIdentifier: return tr("Highlighted identifier"); case Decorator: return tr("Decorator"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerPython::defaultPaper(int style) const { if (style == UnclosedString) return QColor(0xe0,0xc0,0xe0); return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerPython::refreshProperties() { setCommentProp(); setQuotesProp(); setTabWhingeProp(); } // Read properties from the settings. bool QsciLexerPython::readProperties(QSettings &qs,const QString &prefix) { int rc = true, num; fold_comments = qs.value(prefix + "foldcomments", false).toBool(); fold_quotes = qs.value(prefix + "foldquotes", false).toBool(); indent_warn = (IndentationWarning)qs.value(prefix + "indentwarning", (int)NoWarning).toInt(); return rc; } // Write properties to the settings. bool QsciLexerPython::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldcomments", fold_comments); qs.setValue(prefix + "foldquotes", fold_quotes); qs.setValue(prefix + "indentwarning", (int)indent_warn); return rc; } // Return true if comments can be folded. bool QsciLexerPython::foldComments() const { return fold_comments; } // Set if comments can be folded. void QsciLexerPython::setFoldComments(bool fold) { fold_comments = fold; setCommentProp(); } // Set the "fold.comment.python" property. void QsciLexerPython::setCommentProp() { emit propertyChanged("fold.comment.python",(fold_comments ? "1" : "0")); } // Return true if quotes can be folded. bool QsciLexerPython::foldQuotes() const { return fold_quotes; } // Set if quotes can be folded. void QsciLexerPython::setFoldQuotes(bool fold) { fold_quotes = fold; setQuotesProp(); } // Set the "fold.quotes.python" property. void QsciLexerPython::setQuotesProp() { emit propertyChanged("fold.quotes.python",(fold_quotes ? "1" : "0")); } // Return the indentation warning. QsciLexerPython::IndentationWarning QsciLexerPython::indentationWarning() const { return indent_warn; } // Set the indentation warning. void QsciLexerPython::setIndentationWarning(QsciLexerPython::IndentationWarning warn) { indent_warn = warn; setTabWhingeProp(); } // Set the "tab.timmy.whinge.level" property. void QsciLexerPython::setTabWhingeProp() { emit propertyChanged("tab.timmy.whinge.level", QByteArray::number(indent_warn)); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexercss.cpp0000644000175000001440000002057011407213302023224 0ustar subzerousers// This module implements the QsciLexerCSS class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexercss.h" #include #include #include // The ctor. QsciLexerCSS::QsciLexerCSS(QObject *parent) : QsciLexer(parent), fold_comments(false), fold_compact(true) { } // The dtor. QsciLexerCSS::~QsciLexerCSS() { } // Returns the language name. const char *QsciLexerCSS::language() const { return "CSS"; } // Returns the lexer name. const char *QsciLexerCSS::lexer() const { return "css"; } // Return the list of characters that can start a block. const char *QsciLexerCSS::blockStart(int *style) const { if (style) *style = Operator; return "{"; } // Return the list of characters that can end a block. const char *QsciLexerCSS::blockEnd(int *style) const { if (style) *style = Operator; return "}"; } // Return the string of characters that comprise a word. const char *QsciLexerCSS::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-"; } // Returns the foreground colour of the text for a style. QColor QsciLexerCSS::defaultColor(int style) const { switch (style) { case Default: return QColor(0xff,0x00,0x80); case Tag: return QColor(0x00,0x00,0x7f); case PseudoClass: case Attribute: return QColor(0x80,0x00,0x00); case UnknownPseudoClass: case UnknownProperty: return QColor(0xff,0x00,0x00); case Operator: return QColor(0x00,0x00,0x00); case CSS1Property: return QColor(0x00,0x40,0xe0); case Value: case DoubleQuotedString: case SingleQuotedString: return QColor(0x7f,0x00,0x7f); case Comment: return QColor(0x00,0x7f,0x00); case IDSelector: return QColor(0x00,0x7f,0x7f); case Important: return QColor(0xff,0x80,0x00); case AtRule: return QColor(0x7f,0x7f,0x00); case CSS2Property: return QColor(0x00,0xa0,0xe0); } return QsciLexer::defaultColor(style); } // Returns the font of the text for a style. QFont QsciLexerCSS::defaultFont(int style) const { QFont f; if (style == Comment) #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif else { f = QsciLexer::defaultFont(style); switch (style) { case Tag: case Important: case AtRule: f.setBold(true); break; case IDSelector: f.setItalic(true); break; } } return f; } // Returns the set of keywords. const char *QsciLexerCSS::keywords(int set) const { if (set == 1) return "color background-color background-image " "background-repeat background-attachment " "background-position background font-family " "font-style font-variant font-weight font-size font " "word-spacing letter-spacing text-decoration " "vertical-align text-transform text-align " "text-indent line-height margin-top margin-right " "margin-bottom margin-left margin padding-top " "padding-right padding-bottom padding-left padding " "border-top-width border-right-width " "border-bottom-width border-left-width border-width " "border-top border-right border-bottom border-left " "border border-color border-style width height float " "clear display white-space list-style-type " "list-style-image list-style-position list-style"; if (set == 2) return "first-letter first-line link active visited " "first-child focus hover lang before after left " "right first"; if (set == 3) return "border-top-color border-right-color " "border-bottom-color border-left-color border-color " "border-top-style border-right-style " "border-bottom-style border-left-style border-style " "top right bottom left position z-index direction " "unicode-bidi min-width max-width min-height " "max-height overflow clip visibility content quotes " "counter-reset counter-increment marker-offset size " "marks page-break-before page-break-after " "page-break-inside page orphans widows font-stretch " "font-size-adjust unicode-range units-per-em src " "panose-1 stemv stemh slope cap-height x-height " "ascent descent widths bbox definition-src baseline " "centerline mathline topline text-shadow " "caption-side table-layout border-collapse " "border-spacing empty-cells speak-header cursor " "outline outline-width outline-style outline-color " "volume speak pause-before pause-after pause " "cue-before cue-after cue play-during azimuth " "elevation speech-rate voice-family pitch " "pitch-range stress richness speak-punctuation " "speak-numeral"; return 0; } // Returns the user name of a style. QString QsciLexerCSS::description(int style) const { switch (style) { case Default: return tr("Default"); case Tag: return tr("Tag"); case ClassSelector: return tr("Class selector"); case PseudoClass: return tr("Pseudo-class"); case UnknownPseudoClass: return tr("Unknown pseudo-class"); case Operator: return tr("Operator"); case CSS1Property: return tr("CSS1 property"); case UnknownProperty: return tr("Unknown property"); case Value: return tr("Value"); case IDSelector: return tr("ID selector"); case Important: return tr("Important"); case AtRule: return tr("@-rule"); case DoubleQuotedString: return tr("Double-quoted string"); case SingleQuotedString: return tr("Single-quoted string"); case CSS2Property: return tr("CSS2 property"); case Attribute: return tr("Attribute"); } return QString(); } // Refresh all properties. void QsciLexerCSS::refreshProperties() { setCommentProp(); setCompactProp(); } // Read properties from the settings. bool QsciLexerCSS::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_comments = qs.value(prefix + "foldcomments", false).toBool(); fold_compact = qs.value(prefix + "foldcompact", true).toBool(); return rc; } // Write properties to the settings. bool QsciLexerCSS::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldcomments", fold_comments); qs.setValue(prefix + "foldcompact", fold_compact); return rc; } // Return true if comments can be folded. bool QsciLexerCSS::foldComments() const { return fold_comments; } // Set if comments can be folded. void QsciLexerCSS::setFoldComments(bool fold) { fold_comments = fold; setCommentProp(); } // Set the "fold.comment" property. void QsciLexerCSS::setCommentProp() { emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); } // Return true if folds are compact. bool QsciLexerCSS::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerCSS::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerCSS::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerperl.cpp0000644000175000001440000002515611407213302023403 0ustar subzerousers// This module implements the QsciLexerPerl class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerperl.h" #include #include #include // The ctor. QsciLexerPerl::QsciLexerPerl(QObject *parent) : QsciLexer(parent), fold_comments(false), fold_compact(true) { } // The dtor. QsciLexerPerl::~QsciLexerPerl() { } // Returns the language name. const char *QsciLexerPerl::language() const { return "Perl"; } // Returns the lexer name. const char *QsciLexerPerl::lexer() const { return "perl"; } // Return the style used for braces. int QsciLexerPerl::braceStyle() const { return Operator; } // Return the string of characters that comprise a word. const char *QsciLexerPerl::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$@%&"; } // Returns the foreground colour of the text for a style. QColor QsciLexerPerl::defaultColor(int style) const { switch (style) { case Default: return QColor(0x80,0x80,0x80); case Error: case Backticks: case QuotedStringQX: return QColor(0xff,0xff,0x00); case Comment: return QColor(0x00,0x7f,0x00); case POD: case PODVerbatim: return QColor(0x00,0x40,0x00); case Number: return QColor(0x00,0x7f,0x7f); case Keyword: return QColor(0x00,0x00,0x7f); case DoubleQuotedString: case SingleQuotedString: case SingleQuotedHereDocument: case DoubleQuotedHereDocument: case BacktickHereDocument: case QuotedStringQ: case QuotedStringQQ: return QColor(0x7f,0x00,0x7f); case Operator: case Identifier: case Scalar: case Array: case Hash: case SymbolTable: case Regex: case Substitution: case HereDocumentDelimiter: case QuotedStringQR: case QuotedStringQW: return QColor(0x00,0x00,0x00); case DataSection: return QColor(0x60,0x00,0x00); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerPerl::defaultEolFill(int style) const { switch (style) { case POD: case DataSection: case SingleQuotedHereDocument: case DoubleQuotedHereDocument: case BacktickHereDocument: case PODVerbatim: return true; } return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerPerl::defaultFont(int style) const { QFont f; switch (style) { case Comment: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case POD: #if defined(Q_OS_WIN) f = QFont("Times New Roman",11); #else f = QFont("Bitstream Charter",10); #endif break; case Keyword: case Operator: case DoubleQuotedHereDocument: f = QsciLexer::defaultFont(style); f.setBold(true); break; case DoubleQuotedString: case SingleQuotedString: case QuotedStringQQ: case PODVerbatim: #if defined(Q_OS_WIN) f = QFont("Courier New",10); #else f = QFont("Bitstream Vera Sans Mono",9); #endif break; case BacktickHereDocument: f = QsciLexer::defaultFont(style); f.setItalic(true); break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerPerl::keywords(int set) const { if (set == 1) return "NULL __FILE__ __LINE__ __PACKAGE__ __DATA__ __END__ " "AUTOLOAD BEGIN CORE DESTROY END EQ GE GT INIT LE LT " "NE CHECK abs accept alarm and atan2 bind binmode " "bless caller chdir chmod chomp chop chown chr chroot " "close closedir cmp connect continue cos crypt " "dbmclose dbmopen defined delete die do dump each " "else elsif endgrent endhostent endnetent endprotoent " "endpwent endservent eof eq eval exec exists exit exp " "fcntl fileno flock for foreach fork format formline " "ge getc getgrent getgrgid getgrnam gethostbyaddr " "gethostbyname gethostent getlogin getnetbyaddr " "getnetbyname getnetent getpeername getpgrp getppid " "getpriority getprotobyname getprotobynumber " "getprotoent getpwent getpwnam getpwuid getservbyname " "getservbyport getservent getsockname getsockopt glob " "gmtime goto grep gt hex if index int ioctl join keys " "kill last lc lcfirst le length link listen local " "localtime lock log lstat lt m map mkdir msgctl " "msgget msgrcv msgsnd my ne next no not oct open " "opendir or ord our pack package pipe pop pos print " "printf prototype push q qq qr quotemeta qu qw qx " "rand read readdir readline readlink readpipe recv " "redo ref rename require reset return reverse " "rewinddir rindex rmdir s scalar seek seekdir select " "semctl semget semop send setgrent sethostent " "setnetent setpgrp setpriority setprotoent setpwent " "setservent setsockopt shift shmctl shmget shmread " "shmwrite shutdown sin sleep socket socketpair sort " "splice split sprintf sqrt srand stat study sub " "substr symlink syscall sysopen sysread sysseek " "system syswrite tell telldir tie tied time times tr " "truncate uc ucfirst umask undef unless unlink unpack " "unshift untie until use utime values vec wait " "waitpid wantarray warn while write x xor y"; return 0; } // Returns the user name of a style. QString QsciLexerPerl::description(int style) const { switch (style) { case Default: return tr("Default"); case Error: return tr("Error"); case Comment: return tr("Comment"); case POD: return tr("POD"); case Number: return tr("Number"); case Keyword: return tr("Keyword"); case DoubleQuotedString: return tr("Double-quoted string"); case SingleQuotedString: return tr("Single-quoted string"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case Scalar: return tr("Scalar"); case Array: return tr("Array"); case Hash: return tr("Hash"); case SymbolTable: return tr("Symbol table"); case Regex: return tr("Regular expression"); case Substitution: return tr("Substitution"); case Backticks: return tr("Backticks"); case DataSection: return tr("Data section"); case HereDocumentDelimiter: return tr("Here document delimiter"); case SingleQuotedHereDocument: return tr("Single-quoted here document"); case DoubleQuotedHereDocument: return tr("Double-quoted here document"); case BacktickHereDocument: return tr("Backtick here document"); case QuotedStringQ: return tr("Quoted string (q)"); case QuotedStringQQ: return tr("Quoted string (qq)"); case QuotedStringQX: return tr("Quoted string (qx)"); case QuotedStringQR: return tr("Quoted string (qr)"); case QuotedStringQW: return tr("Quoted string (qw)"); case PODVerbatim: return tr("POD verbatim"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerPerl::defaultPaper(int style) const { switch (style) { case Error: return QColor(0xff,0x00,0x00); case POD: return QColor(0xe0,0xff,0xe0); case Scalar: return QColor(0xff,0xe0,0xe0); case Array: return QColor(0xff,0xff,0xe0); case Hash: return QColor(0xff,0xe0,0xff); case SymbolTable: return QColor(0xe0,0xe0,0xe0); case Regex: return QColor(0xa0,0xff,0xa0); case Substitution: return QColor(0xf0,0xe0,0x80); case Backticks: return QColor(0xa0,0x80,0x80); case DataSection: return QColor(0xff,0xf0,0xd8); case HereDocumentDelimiter: case SingleQuotedHereDocument: case DoubleQuotedHereDocument: case BacktickHereDocument: return QColor(0xdd,0xd0,0xdd); case PODVerbatim: return QColor(0xc0,0xff,0xc0); } return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerPerl::refreshProperties() { setCommentProp(); setCompactProp(); } // Read properties from the settings. bool QsciLexerPerl::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_comments = qs.value(prefix + "foldcomments", false).toBool(); fold_compact = qs.value(prefix + "foldcompact", true).toBool(); return rc; } // Write properties to the settings. bool QsciLexerPerl::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldcomments", fold_comments); qs.setValue(prefix + "foldcompact", fold_compact); return rc; } // Return true if comments can be folded. bool QsciLexerPerl::foldComments() const { return fold_comments; } // Set if comments can be folded. void QsciLexerPerl::setFoldComments(bool fold) { fold_comments = fold; setCommentProp(); } // Set the "fold.comment" property. void QsciLexerPerl::setCommentProp() { emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); } // Return true if folds are compact. bool QsciLexerPerl::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerPerl::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerPerl::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerjava.cpp0000644000175000001440000000335311407213302023355 0ustar subzerousers// This module implements the QsciLexerJava class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerjava.h" // The ctor. QsciLexerJava::QsciLexerJava(QObject *parent) : QsciLexerCPP(parent) { } // The dtor. QsciLexerJava::~QsciLexerJava() { } // Returns the language name. const char *QsciLexerJava::language() const { return "Java"; } // Returns the set of keywords. const char *QsciLexerJava::keywords(int set) const { if (set != 1) return 0; return "abstract assert boolean break byte case catch char class " "const continue default do double else extends final finally " "float for future generic goto if implements import inner " "instanceof int interface long native new null operator outer " "package private protected public rest return short static " "super switch synchronized this throw throws transient try var " "void volatile while"; } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/ScintillaQt.cpp0000644000175000001440000003072611407213302022747 0ustar subzerousers// The implementation of the Qt specific subclass of ScintillaBase. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include #include #include #include #include #include #include "Qsci/qsciscintillabase.h" #include "ScintillaQt.h" #include "SciClasses.h" // We want to use the Scintilla notification names as Qt signal names. #undef SCEN_CHANGE #undef SCN_AUTOCSELECTION #undef SCN_CALLTIPCLICK #undef SCN_CHARADDED #undef SCN_DOUBLECLICK #undef SCN_DWELLEND #undef SCN_DWELLSTART #undef SCN_HOTSPOTCLICK #undef SCN_HOTSPOTDOUBLECLICK #undef SCN_INDICATORCLICK #undef SCN_INDICATORRELEASE #undef SCN_MACRORECORD #undef SCN_MARGINCLICK #undef SCN_MODIFIED #undef SCN_MODIFYATTEMPTRO #undef SCN_NEEDSHOWN #undef SCN_PAINTED #undef SCN_SAVEPOINTLEFT #undef SCN_SAVEPOINTREACHED #undef SCN_STYLENEEDED #undef SCN_UPDATEUI #undef SCN_USERLISTSELECTION #undef SCN_ZOOM enum { SCEN_CHANGE = 768, SCN_AUTOCSELECTION = 2022, SCN_CALLTIPCLICK = 2021, SCN_CHARADDED = 2001, SCN_DOUBLECLICK = 2006, SCN_DWELLEND = 2017, SCN_DWELLSTART = 2016, SCN_HOTSPOTCLICK = 2019, SCN_HOTSPOTDOUBLECLICK = 2020, SCN_INDICATORCLICK = 2023, SCN_INDICATORRELEASE = 2024, SCN_MACRORECORD = 2009, SCN_MARGINCLICK = 2010, SCN_MODIFIED = 2008, SCN_MODIFYATTEMPTRO = 2004, SCN_NEEDSHOWN = 2011, SCN_PAINTED = 2013, SCN_SAVEPOINTLEFT = 2003, SCN_SAVEPOINTREACHED = 2002, SCN_STYLENEEDED = 2000, SCN_UPDATEUI = 2007, SCN_USERLISTSELECTION = 2014, SCN_ZOOM = 2018 }; // The ctor. ScintillaQt::ScintillaQt(QsciScintillaBase *qsb_) : capturedMouse(false), qsb(qsb_) { wMain = qsb->viewport(); // We aren't a QObject so we use the API class to do QObject related things // for us. qsb->connect(&qtimer, SIGNAL(timeout()), SLOT(handleTimer())); Initialise(); } // The dtor. ScintillaQt::~ScintillaQt() { Finalise(); } // Initialise the instance. void ScintillaQt::Initialise() { SetTicking(true); } // Tidy up the instance. void ScintillaQt::Finalise() { SetTicking(false); ScintillaBase::Finalise(); } // Start a drag. void ScintillaQt::StartDrag() { QMimeData *mime = new QMimeData; mime->setText(textRange(&drag)); QDrag *drag = new QDrag(qsb); drag->setMimeData(mime); Qt::DropActions actions = Qt::CopyAction; if (!pdoc->IsReadOnly()) actions |= Qt::MoveAction; Qt::DropAction action = drag->start(actions); // Remove the dragged text if it was a move to another widget or // application. if (action == Qt::MoveAction && drag->target() != qsb) ClearSelection(); inDragDrop = ddNone; SetDragPosition(-1); } // Re-implement to trap certain messages. sptr_t ScintillaQt::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { switch (iMessage) { case SCI_GETDIRECTFUNCTION: return reinterpret_cast(DirectFunction); case SCI_GETDIRECTPOINTER: return reinterpret_cast(this); } return ScintillaBase::WndProc(iMessage, wParam, lParam); } // Windows nonsense. sptr_t ScintillaQt::DefWndProc(unsigned int, uptr_t, sptr_t) { return 0; } // Manage the timer. void ScintillaQt::SetTicking(bool on) { if (timer.ticking != on) { timer.ticking = on; if (timer.ticking) qtimer.start(timer.tickSize); else qtimer.stop(); } timer.ticksToWait = caret.period; } // Grab or release the mouse (and keyboard). void ScintillaQt::SetMouseCapture(bool on) { if (mouseDownCaptures) if (on) qsb->viewport()->grabMouse(); else qsb->viewport()->releaseMouse(); capturedMouse = on; } // Return true if the mouse/keyboard are currently grabbed. bool ScintillaQt::HaveMouseCapture() { return capturedMouse; } // Set the position of the vertical scrollbar. void ScintillaQt::SetVerticalScrollPos() { qsb->verticalScrollBar()->setValue(topLine); } // Set the position of the horizontal scrollbar. void ScintillaQt::SetHorizontalScrollPos() { qsb->horizontalScrollBar()->setValue(xOffset); } // Set the extent of the vertical and horizontal scrollbars and return true if // the view needs re-drawing. bool ScintillaQt::ModifyScrollBars(int nMax,int nPage) { qsb->verticalScrollBar()->setMinimum(0); qsb->horizontalScrollBar()->setMinimum(0); qsb->verticalScrollBar()->setMaximum(nMax - nPage + 1); qsb->horizontalScrollBar()->setMaximum(scrollWidth); qsb->verticalScrollBar()->setSingleStep(1); qsb->verticalScrollBar()->setPageStep(nPage); qsb->horizontalScrollBar()->setPageStep(scrollWidth / 10); return true; } // Called after SCI_SETWRAPMODE and SCI_SETHSCROLLBAR. void ScintillaQt::ReconfigureScrollBars() { // Hide or show the scrollbars if needed. bool hsb = (horizontalScrollBarVisible && wrapState == eWrapNone); qsb->setHorizontalScrollBarPolicy(hsb ? Qt::ScrollBarAlwaysOn : Qt::ScrollBarAlwaysOff); qsb->setVerticalScrollBarPolicy(verticalScrollBarVisible ? Qt::ScrollBarAlwaysOn : Qt::ScrollBarAlwaysOff); } // Notify interested parties of any change in the document. void ScintillaQt::NotifyChange() { emit qsb->SCEN_CHANGE(); } // Notify interested parties of various events. This is the main mapping // between Scintilla notifications and Qt signals. void ScintillaQt::NotifyParent(SCNotification scn) { switch (scn.nmhdr.code) { case SCN_CALLTIPCLICK: emit qsb->SCN_CALLTIPCLICK(scn.position); break; case SCN_AUTOCSELECTION: emit qsb->SCN_AUTOCSELECTION(scn.text, scn.lParam); break; case SCN_CHARADDED: emit qsb->SCN_CHARADDED(scn.ch); break; case SCN_DOUBLECLICK: emit qsb->SCN_DOUBLECLICK(scn.position, scn.line, scn.modifiers); break; case SCN_DWELLEND: emit qsb->SCN_DWELLEND(scn.position, scn.x, scn.y); break; case SCN_DWELLSTART: emit qsb->SCN_DWELLSTART(scn.position, scn.x, scn.y); break; case SCN_HOTSPOTCLICK: emit qsb->SCN_HOTSPOTCLICK(scn.position, scn.modifiers); break; case SCN_HOTSPOTDOUBLECLICK: emit qsb->SCN_HOTSPOTDOUBLECLICK(scn.position, scn.modifiers); break; case SCN_INDICATORCLICK: emit qsb->SCN_INDICATORCLICK(scn.position, scn.modifiers); break; case SCN_INDICATORRELEASE: emit qsb->SCN_INDICATORRELEASE(scn.position, scn.modifiers); break; case SCN_MACRORECORD: emit qsb->SCN_MACRORECORD(scn.message, scn.wParam, scn.lParam); break; case SCN_MARGINCLICK: emit qsb->SCN_MARGINCLICK(scn.position, scn.modifiers, scn.margin); break; case SCN_MODIFIED: emit qsb->SCN_MODIFIED(scn.position, scn.modificationType, scn.text, scn.length,scn.linesAdded, scn.line, scn.foldLevelNow, scn.foldLevelPrev); break; case SCN_MODIFYATTEMPTRO: emit qsb->SCN_MODIFYATTEMPTRO(); break; case SCN_NEEDSHOWN: emit qsb->SCN_NEEDSHOWN(scn.position, scn.length); break; case SCN_PAINTED: emit qsb->SCN_PAINTED(); break; case SCN_SAVEPOINTLEFT: emit qsb->SCN_SAVEPOINTLEFT(); break; case SCN_SAVEPOINTREACHED: emit qsb->SCN_SAVEPOINTREACHED(); break; case SCN_STYLENEEDED: emit qsb->SCN_STYLENEEDED(scn.position); break; case SCN_UPDATEUI: emit qsb->SCN_UPDATEUI(); break; case SCN_USERLISTSELECTION: emit qsb->SCN_USERLISTSELECTION(scn.text, scn.wParam); break; case SCN_ZOOM: emit qsb->SCN_ZOOM(); break; default: qWarning("Unknown notification: %u", scn.nmhdr.code); } } // Convert a text range to a QString. QString ScintillaQt::textRange(const SelectionText *text) { if (!text->s) return QString(); if (IsUnicodeMode()) return QString::fromUtf8(text->s); return QString::fromLatin1(text->s); } // Copy the selected text to the clipboard. void ScintillaQt::CopyToClipboard(const SelectionText &selectedText) { QApplication::clipboard()->setText(textRange(&selectedText)); } // Implement copy. void ScintillaQt::Copy() { if (currentPos != anchor) { SelectionText text; CopySelectionRange(&text); CopyToClipboard(text); } } // Implement pasting text. void ScintillaQt::Paste() { pasteFromClipboard(QClipboard::Clipboard); } // Paste text from either the clipboard or selection. void ScintillaQt::pasteFromClipboard(QClipboard::Mode mode) { QString str = QApplication::clipboard()->text(mode); if (str.isEmpty()) return; pdoc->BeginUndoAction(); ClearSelection(); int len; const char *s; QByteArray bytes; if (IsUnicodeMode()) { bytes = str.toUtf8(); len = bytes.length(); s = bytes.data(); } else { bytes = str.toLatin1(); len = bytes.length(); s = bytes.data(); } if (len) pdoc->InsertString(currentPos, s, len); SetEmptySelection(currentPos + len); pdoc->EndUndoAction(); NotifyChange(); Redraw(); } // Create a call tip window. void ScintillaQt::CreateCallTipWindow(PRectangle rc) { if (!ct.wCallTip.Created()) ct.wCallTip = ct.wDraw = new SciCallTip(qsb, this); SciCallTip *w = reinterpret_cast(ct.wCallTip.GetID()); w->resize(rc.right - rc.left, rc.bottom - rc.top); ct.wCallTip.Show(); } // Add an item to the right button menu. void ScintillaQt::AddToPopUp(const char *label, int cmd, bool enabled) { SciPopup *pm = static_cast(popup.GetID()); if (*label) pm->addItem(qApp->translate("ContextMenu", label), cmd, enabled, this); else pm->addSeparator(); } // Claim the selection. void ScintillaQt::ClaimSelection() { bool isSel = (currentPos != anchor); if (isSel) { QClipboard *cb = QApplication::clipboard(); // If we support X11 style selection then make it available now. if (cb->supportsSelection()) { SelectionText text; CopySelectionRange(&text); if (text.s) cb->setText(text.s, QClipboard::Selection); } primarySelection = true; } else primarySelection = false; emit qsb->QSCN_SELCHANGED(isSel); } // Unclaim the selection. void ScintillaQt::UnclaimSelection() { if (primarySelection) { primarySelection = false; qsb->viewport()->update(); } } // Implemented to provide compatibility with the Windows version. sptr_t ScintillaQt::DirectFunction(ScintillaQt *sciThis, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { return sciThis->WndProc(iMessage,wParam,lParam); } // Draw the contents of the widget. void ScintillaQt::paintEvent(QPaintEvent *e) { Surface *sw = Surface::Allocate(); if (!sw) return; paintState = painting; const QRect &qr = e->rect(); rcPaint.left = qr.left(); rcPaint.top = qr.top(); rcPaint.right = qr.right() + 1; rcPaint.bottom = qr.bottom() + 1; PRectangle rcText = GetTextRectangle(); paintingAllText = rcPaint.Contains(rcText); QPainter painter(qsb->viewport()); sw->Init(&painter); sw->SetUnicodeMode(CodePage() == SC_CP_UTF8); Paint(sw, rcPaint); delete sw; // If the painting area was insufficient to cover the new style or brace // highlight positions then repaint the whole thing. if (paintState == paintAbandoned) qsb->viewport()->update(); paintState = notPainting; } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexer.cpp0000644000175000001440000003317711407213302022522 0ustar subzerousers// This module implements the QsciLexer class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexer.h" #include #include #include #include #include "Qsci/qsciapis.h" #include "Qsci/qsciscintilla.h" #include "Qsci/qsciscintillabase.h" // The ctor. QsciLexer::QsciLexer(QObject *parent) : QObject(parent), autoIndStyle(-1), apiSet(0) { #if defined(Q_OS_WIN) defFont = QFont("Verdana",10); #else defFont = QFont("Bitstream Vera Sans",9); #endif // Set the default fore and background colours. QPalette pal = QApplication::palette(); defColor = pal.text().color(); defPaper = pal.base().color(); // Putting this on the heap means we can keep the style getters const. style_map = new StyleDataMap; style_map->style_data_set = false; } // The dtor. QsciLexer::~QsciLexer() { delete style_map; } // Make sure the style defaults have been set. void QsciLexer::setStyleDefaults() const { if (!style_map->style_data_set) { for (int i = 0; i < 128; ++i) if (!description(i).isEmpty()) styleData(i); style_map->style_data_set = true; } } // Return a reference to a style's data, setting up the defaults if needed. QsciLexer::StyleData &QsciLexer::styleData(int style) const { StyleData &sd = style_map->style_data[style]; // See if this is a new style by checking if the colour is valid. if (!sd.color.isValid()) { sd.color = defaultColor(style); sd.paper = defaultPaper(style); sd.font = defaultFont(style); sd.eol_fill = defaultEolFill(style); } return sd; } // Set the APIs associated with the lexer. void QsciLexer::setAPIs(QsciAPIs *apis) { apiSet = apis; } // Return a pointer to the current APIs if there are any. QsciAPIs *QsciLexer::apis() const { return apiSet; } // Default implementation to return the set of fill up characters that can end // auto-completion. const char *QsciLexer::autoCompletionFillups() const { return "("; } // Default implementation to return the list of character sequences that can // separate auto-completion words. QStringList QsciLexer::autoCompletionWordSeparators() const { return QStringList(); } // Default implementation to return the list of keywords that can start a // block. const char *QsciLexer::blockStartKeyword(int *) const { return 0; } // Default implementation to return the list of characters that can start a // block. const char *QsciLexer::blockStart(int *) const { return 0; } // Default implementation to return the list of characters that can end a // block. const char *QsciLexer::blockEnd(int *) const { return 0; } // Default implementation to return the style used for braces. int QsciLexer::braceStyle() const { return -1; } // Default implementation to return the number of lines to look back when // auto-indenting. int QsciLexer::blockLookback() const { return 20; } // Default implementation to return the case sensitivity of the language. bool QsciLexer::caseSensitive() const { return true; } // Default implementation to return the characters that make up a word. const char *QsciLexer::wordCharacters() const { return 0; } // Default implementation to return the style used for whitespace. int QsciLexer::defaultStyle() const { return 0; } // Returns the foreground colour of the text for a style. QColor QsciLexer::color(int style) const { return styleData(style).color; } // Returns the background colour of the text for a style. QColor QsciLexer::paper(int style) const { return styleData(style).paper; } // Returns the font for a style. QFont QsciLexer::font(int style) const { return styleData(style).font; } // Returns the end-of-line fill for a style. bool QsciLexer::eolFill(int style) const { return styleData(style).eol_fill; } // Returns the set of keywords. const char *QsciLexer::keywords(int) const { return 0; } // Returns the default EOL fill for a style. bool QsciLexer::defaultEolFill(int) const { return false; } // Returns the default font for a style. QFont QsciLexer::defaultFont(int) const { return defaultFont(); } // Returns the default font. QFont QsciLexer::defaultFont() const { return defFont; } // Sets the default font. void QsciLexer::setDefaultFont(const QFont &f) { defFont = f; } // Returns the default text colour for a style. QColor QsciLexer::defaultColor(int) const { return defaultColor(); } // Returns the default text colour. QColor QsciLexer::defaultColor() const { return defColor; } // Sets the default text colour. void QsciLexer::setDefaultColor(const QColor &c) { defColor = c; } // Returns the default paper colour for a styles. QColor QsciLexer::defaultPaper(int) const { return defaultPaper(); } // Returns the default paper colour. QColor QsciLexer::defaultPaper() const { return defPaper; } // Sets the default paper colour. void QsciLexer::setDefaultPaper(const QColor &c) { defPaper = c; // Normally the default values are only intended to provide defaults when a // lexer is first setup because once a style has been referenced then a // copy of the default is made. However the default paper is a special // case because there is no other way to set the background colour used // where there is no text. Therefore we also actively set it. setPaper(c, QsciScintillaBase::STYLE_DEFAULT); } // Read properties from the settings. bool QsciLexer::readProperties(QSettings &,const QString &) { return true; } // Refresh all properties. void QsciLexer::refreshProperties() { } // Write properties to the settings. bool QsciLexer::writeProperties(QSettings &,const QString &) const { return true; } // Restore the user settings. bool QsciLexer::readSettings(QSettings &qs,const char *prefix) { bool ok, flag, rc = true; int num; QString key, full_key; QStringList fdesc; setStyleDefaults(); // Read the styles. for (int i = 0; i < 128; ++i) { // Ignore invalid styles. if (description(i).isEmpty()) continue; key.sprintf("%s/%s/style%d/",prefix,language(),i); // Read the foreground colour. full_key = key + "color"; ok = qs.contains(full_key); num = qs.value(full_key).toInt(); if (ok) setColor(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i); else rc = false; // Read the end-of-line fill. full_key = key + "eolfill"; ok = qs.contains(full_key); flag = qs.value(full_key, false).toBool(); if (ok) setEolFill(flag, i); else rc = false; // Read the font full_key = key + "font"; ok = qs.contains(full_key); fdesc = qs.value(full_key).toStringList(); if (ok && fdesc.count() == 5) { QFont f; f.setFamily(fdesc[0]); f.setPointSize(fdesc[1].toInt()); f.setBold(fdesc[2].toInt()); f.setItalic(fdesc[3].toInt()); f.setUnderline(fdesc[4].toInt()); setFont(f, i); } else rc = false; // Read the background colour. full_key = key + "paper"; ok = qs.contains(full_key); num = qs.value(full_key).toInt(); if (ok) setPaper(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i); else rc = false; } // Read the properties. key.sprintf("%s/%s/properties/",prefix,language()); if (!readProperties(qs,key)) rc = false; refreshProperties(); // Read the rest. key.sprintf("%s/%s/",prefix,language()); // Read the default foreground colour. full_key = key + "defaultcolor"; ok = qs.contains(full_key); num = qs.value(full_key).toInt(); if (ok) setDefaultColor(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff)); else rc = false; // Read the default background colour. full_key = key + "defaultpaper"; ok = qs.contains(full_key); num = qs.value(full_key).toInt(); if (ok) setDefaultPaper(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff)); else rc = false; // Read the default font. full_key = key + "defaultfont"; ok = qs.contains(full_key); fdesc = qs.value(full_key).toStringList(); if (ok && fdesc.count() == 5) { QFont f; f.setFamily(fdesc[0]); f.setPointSize(fdesc[1].toInt()); f.setBold(fdesc[2].toInt()); f.setItalic(fdesc[3].toInt()); f.setUnderline(fdesc[4].toInt()); setDefaultFont(f); } else rc = false; full_key = key + "autoindentstyle"; ok = qs.contains(full_key); num = qs.value(full_key).toInt(); if (ok) setAutoIndentStyle(num); else rc = false; return rc; } // Save the user settings. bool QsciLexer::writeSettings(QSettings &qs,const char *prefix) const { bool rc = true; QString key, fmt("%1"); int num; QStringList fdesc; setStyleDefaults(); // Write the styles. for (int i = 0; i < 128; ++i) { // Ignore invalid styles. if (description(i).isEmpty()) continue; QColor c; key.sprintf("%s/%s/style%d/",prefix,language(),i); // Write the foreground colour. c = color(i); num = (c.red() << 16) | (c.green() << 8) | c.blue(); qs.setValue(key + "color", num); // Write the end-of-line fill. qs.setValue(key + "eolfill", eolFill(i)); // Write the font QFont f = font(i); fdesc.clear(); fdesc += f.family(); fdesc += fmt.arg(f.pointSize()); // The casts are for Borland. fdesc += fmt.arg((int)f.bold()); fdesc += fmt.arg((int)f.italic()); fdesc += fmt.arg((int)f.underline()); qs.setValue(key + "font", fdesc); // Write the background colour. c = paper(i); num = (c.red() << 16) | (c.green() << 8) | c.blue(); qs.setValue(key + "paper", num); } // Write the properties. key.sprintf("%s/%s/properties/",prefix,language()); if (!writeProperties(qs,key)) rc = false; // Write the rest. key.sprintf("%s/%s/",prefix,language()); // Write the default foreground colour. num = (defColor.red() << 16) | (defColor.green() << 8) | defColor.blue(); qs.setValue(key + "defaultcolor", num); // Write the default background colour. num = (defPaper.red() << 16) | (defPaper.green() << 8) | defPaper.blue(); qs.setValue(key + "defaultpaper", num); // Write the default font fdesc.clear(); fdesc += defFont.family(); fdesc += fmt.arg(defFont.pointSize()); // The casts are for Borland. fdesc += fmt.arg((int)defFont.bold()); fdesc += fmt.arg((int)defFont.italic()); fdesc += fmt.arg((int)defFont.underline()); qs.setValue(key + "defaultfont", fdesc); qs.setValue(key + "autoindentstyle", autoIndStyle); return rc; } // Return the auto-indentation style. int QsciLexer::autoIndentStyle() { // We can't do this in the ctor because we want the virtuals to work. if (autoIndStyle < 0) autoIndStyle = (blockStartKeyword() || blockStart() || blockEnd()) ? 0 : QsciScintilla::AiMaintain; return autoIndStyle; } // Set the auto-indentation style. void QsciLexer::setAutoIndentStyle(int autoindentstyle) { autoIndStyle = autoindentstyle; } // Set the foreground colour for a style. void QsciLexer::setColor(const QColor &c, int style) { if (style >= 0) { styleData(style).color = c; emit colorChanged(c, style); } else for (int i = 0; i < 128; ++i) if (!description(i).isEmpty()) setColor(c, i); } // Set the end-of-line fill for a style. void QsciLexer::setEolFill(bool eolfill, int style) { if (style >= 0) { styleData(style).eol_fill = eolfill; emit eolFillChanged(eolfill, style); } else for (int i = 0; i < 128; ++i) if (!description(i).isEmpty()) setEolFill(eolfill, i); } // Set the font for a style. void QsciLexer::setFont(const QFont &f, int style) { if (style >= 0) { styleData(style).font = f; emit fontChanged(f, style); } else for (int i = 0; i < 128; ++i) if (!description(i).isEmpty()) setFont(f, i); } // Set the background colour for a style. void QsciLexer::setPaper(const QColor &c, int style) { if (style >= 0) { styleData(style).paper = c; emit paperChanged(c, style); } else { for (int i = 0; i < 128; ++i) if (!description(i).isEmpty()) setPaper(c, i); emit paperChanged(c, QsciScintillaBase::STYLE_DEFAULT); } } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerruby.cpp0000644000175000001440000001666611407213302023430 0ustar subzerousers// This module implements the QsciLexerRuby class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerruby.h" #include #include // The ctor. QsciLexerRuby::QsciLexerRuby(QObject *parent) : QsciLexer(parent) { } // The dtor. QsciLexerRuby::~QsciLexerRuby() { } // Returns the language name. const char *QsciLexerRuby::language() const { return "Ruby"; } // Returns the lexer name. const char *QsciLexerRuby::lexer() const { return "ruby"; } // Return the list of words that can start a block. const char *QsciLexerRuby::blockStart(int *style) const { if (style) *style = Keyword; return "do"; } // Return the list of words that can start end a block. const char *QsciLexerRuby::blockEnd(int *style) const { if (style) *style = Keyword; return "end"; } // Return the list of words that can start end a block. const char *QsciLexerRuby::blockStartKeyword(int *style) const { if (style) *style = Keyword; return "def class if do elsif else case while for"; } // Return the style used for braces. int QsciLexerRuby::braceStyle() const { return Operator; } // Returns the foreground colour of the text for a style. QColor QsciLexerRuby::defaultColor(int style) const { switch (style) { case Default: return QColor(0x80,0x80,0x80); case Comment: return QColor(0x00,0x7f,0x00); case POD: return QColor(0x00,0x40,0x00); case Number: case FunctionMethodName: return QColor(0x00,0x7f,0x7f); case Keyword: case DemotedKeyword: return QColor(0x00,0x00,0x7f); case DoubleQuotedString: case SingleQuotedString: case HereDocument: case PercentStringq: case PercentStringQ: return QColor(0x7f,0x00,0x7f); case ClassName: return QColor(0x00,0x00,0xff); case Regex: case HereDocumentDelimiter: case PercentStringr: case PercentStringw: return QColor(0x00,0x00,0x00); case Global: return QColor(0x80,0x00,0x80); case Symbol: return QColor(0xc0,0xa0,0x30); case ModuleName: return QColor(0xa0,0x00,0xa0); case InstanceVariable: return QColor(0xb0,0x00,0x80); case ClassVariable: return QColor(0x80,0x00,0xb0); case Backticks: case PercentStringx: return QColor(0xff,0xff,0x00); case DataSection: return QColor(0x60,0x00,0x00); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerRuby::defaultEolFill(int style) const { bool fill; switch (style) { case POD: case DataSection: case HereDocument: fill = true; break; default: fill = QsciLexer::defaultEolFill(style); } return fill; } // Returns the font of the text for a style. QFont QsciLexerRuby::defaultFont(int style) const { QFont f; switch (style) { case Comment: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case POD: case DoubleQuotedString: case SingleQuotedString: case PercentStringq: case PercentStringQ: #if defined(Q_OS_WIN) f = QFont("Courier New",10); #else f = QFont("Bitstream Vera Sans Mono",9); #endif break; case Keyword: case ClassName: case FunctionMethodName: case Operator: case ModuleName: case DemotedKeyword: f = QsciLexer::defaultFont(style); f.setBold(true); break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerRuby::keywords(int set) const { if (set == 1) return "__FILE__ and def end in or self unless __LINE__ " "begin defined? ensure module redo super until BEGIN " "break do false next rescue then when END case else " "for nil require retry true while alias class elsif " "if not return undef yield"; return 0; } // Returns the user name of a style. QString QsciLexerRuby::description(int style) const { switch (style) { case Default: return tr("Default"); case Error: return tr("Error"); case Comment: return tr("Comment"); case POD: return tr("POD"); case Number: return tr("Number"); case Keyword: return tr("Keyword"); case DoubleQuotedString: return tr("Double-quoted string"); case SingleQuotedString: return tr("Single-quoted string"); case ClassName: return tr("Class name"); case FunctionMethodName: return tr("Function or method name"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case Regex: return tr("Regular expression"); case Global: return tr("Global"); case Symbol: return tr("Symbol"); case ModuleName: return tr("Module name"); case InstanceVariable: return tr("Instance variable"); case ClassVariable: return tr("Class variable"); case Backticks: return tr("Backticks"); case DataSection: return tr("Data section"); case HereDocumentDelimiter: return tr("Here document delimiter"); case HereDocument: return tr("Here document"); case PercentStringq: return tr("%q string"); case PercentStringQ: return tr("%Q string"); case PercentStringx: return tr("%x string"); case PercentStringr: return tr("%r string"); case PercentStringw: return tr("%w string"); case DemotedKeyword: return tr("Demoted keyword"); case Stdin: return tr("stdin"); case Stdout: return tr("stdout"); case Stderr: return tr("stderr"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerRuby::defaultPaper(int style) const { switch (style) { case Error: return QColor(0xff,0x00,0x00); case POD: return QColor(0xc0,0xff,0xc0); case Regex: case PercentStringr: return QColor(0xa0,0xff,0xa0); case Backticks: case PercentStringx: return QColor(0xa0,0x80,0x80); case DataSection: return QColor(0xff,0xf0,0xd8); case HereDocumentDelimiter: case HereDocument: return QColor(0xdd,0xd0,0xdd); case PercentStringw: return QColor(0xff,0xff,0xe0); case Stdin: case Stdout: case Stderr: return QColor(0xff,0x80,0x80); } return QsciLexer::defaultPaper(style); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qsciscintillabase.cpp0000644000175000001440000003154311407213302024213 0ustar subzerousers// This module implements the "official" low-level API. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qsciscintillabase.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ScintillaQt.h" // The #defines in Scintilla.h and the enums in qsciscintillabase.h conflict // (because we want to use the same names) so we have to undefine those we use // in this file. #undef SCI_SETCARETPERIOD #undef SCK_DOWN #undef SCK_UP #undef SCK_LEFT #undef SCK_RIGHT #undef SCK_HOME #undef SCK_END #undef SCK_PRIOR #undef SCK_NEXT #undef SCK_DELETE #undef SCK_INSERT #undef SCK_ESCAPE #undef SCK_BACK #undef SCK_TAB #undef SCK_RETURN #undef SCK_ADD #undef SCK_SUBTRACT #undef SCK_DIVIDE #undef SCK_WIN #undef SCK_RWIN #undef SCK_MENU // Remember if we have linked the lexers. static bool lexersLinked = false; // The list of instances. static QList poolList; // The ctor. QsciScintillaBase::QsciScintillaBase(QWidget *parent) : QAbstractScrollArea(parent) { connect(verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(handleVSb(int))); connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), SLOT(handleHSb(int))); setAcceptDrops(true); setFocusPolicy(Qt::WheelFocus); setAttribute(Qt::WA_KeyCompression); viewport()->setBackgroundRole(QPalette::Base); viewport()->setMouseTracking(true); triple_click.setSingleShot(true); sci = new ScintillaQt(this); SendScintilla(SCI_SETCARETPERIOD, QApplication::cursorFlashTime() / 2); // Make sure the lexers are linked in. if (!lexersLinked) { Scintilla_LinkLexers(); lexersLinked = true; } QClipboard *cb = QApplication::clipboard(); if (cb->supportsSelection()) connect(cb, SIGNAL(selectionChanged()), SLOT(handleSelection())); // Add it to the pool. poolList.append(this); } // The dtor. QsciScintillaBase::~QsciScintillaBase() { // Remove it from the pool. poolList.removeAt(poolList.indexOf(this)); delete sci; } // Return an instance from the pool. QsciScintillaBase *QsciScintillaBase::pool() { return poolList.first(); } // Send a message to the real Scintilla widget using the low level Scintilla // API. long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, long lParam) const { return sci->WndProc(msg, wParam, lParam); } // Send a message to the real Scintilla widget that needs a TextRange // structure. long QsciScintillaBase::SendScintilla(unsigned int msg, long cpMin, long cpMax, char *lpstrText) const { TextRange tr; tr.chrg.cpMin = cpMin; tr.chrg.cpMax = cpMax; tr.lpstrText = lpstrText; return sci->WndProc(msg, 0, reinterpret_cast(&tr)); } // Send a message to the real Scintilla widget that needs a RangeToFormat // structure. long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, QPainter *hdc, const QRect &rc, long cpMin, long cpMax) const { RangeToFormat rf; rf.hdc = rf.hdcTarget = reinterpret_cast(hdc); rf.rc.left = rc.left(); rf.rc.top = rc.top(); rf.rc.right = rc.right() + 1; rf.rc.bottom = rc.bottom() + 1; rf.chrg.cpMin = cpMin; rf.chrg.cpMax = cpMax; return sci->WndProc(msg, wParam, reinterpret_cast(&rf)); } // Send a message to the real Scintilla widget that needs a colour. long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, const QColor &col) const { long lParam = (col.blue() << 16) | (col.green() << 8) | col.red(); return sci->WndProc(msg, wParam, lParam); } // Send a message to the real Scintilla widget that needs a colour. long QsciScintillaBase::SendScintilla(unsigned int msg, const QColor &col) const { unsigned long wParam = (col.blue() << 16) | (col.green() << 8) | col.red(); return sci->WndProc(msg, wParam, 0); } // Handle the timer on behalf of the ScintillaQt instance. void QsciScintillaBase::handleTimer() { sci->Tick(); } // Re-implemented to handle the context menu. void QsciScintillaBase::contextMenuEvent(QContextMenuEvent *e) { sci->ContextMenu(Point(e->globalX(), e->globalY())); } // Re-implemented to tell the widget it has the focus. void QsciScintillaBase::focusInEvent(QFocusEvent *) { sci->SetFocusState(true); } // Re-implemented to tell the widget it has lost the focus. void QsciScintillaBase::focusOutEvent(QFocusEvent *) { sci->SetFocusState(false); } // Re-implemented to make sure tabs are passed to the editor. bool QsciScintillaBase::focusNextPrevChild(bool next) { if (!sci->pdoc->IsReadOnly()) return false; return QAbstractScrollArea::focusNextPrevChild(next); } // Handle the selection changing. void QsciScintillaBase::handleSelection() { if (!QApplication::clipboard()->ownsSelection()) sci->UnclaimSelection(); } // Handle key presses. void QsciScintillaBase::keyPressEvent(QKeyEvent *e) { unsigned key; QByteArray utf8; bool shift = e->modifiers() & Qt::ShiftModifier; bool ctrl = e->modifiers() & Qt::ControlModifier; bool alt = e->modifiers() & Qt::AltModifier; switch (e->key()) { case Qt::Key_Down: key = SCK_DOWN; break; case Qt::Key_Up: key = SCK_UP; break; case Qt::Key_Left: key = SCK_LEFT; break; case Qt::Key_Right: key = SCK_RIGHT; break; case Qt::Key_Home: key = SCK_HOME; break; case Qt::Key_End: key = SCK_END; break; case Qt::Key_PageUp: key = SCK_PRIOR; break; case Qt::Key_PageDown: key = SCK_NEXT; break; case Qt::Key_Delete: key = SCK_DELETE; break; case Qt::Key_Insert: key = SCK_INSERT; break; case Qt::Key_Escape: key = SCK_ESCAPE; break; case Qt::Key_Backspace: key = SCK_BACK; break; case Qt::Key_Tab: key = SCK_TAB; break; case Qt::Key_Return: case Qt::Key_Enter: key = SCK_RETURN; break; case Qt::Key_Super_L: key = SCK_WIN; break; case Qt::Key_Super_R: key = SCK_RWIN; break; case Qt::Key_Menu: key = SCK_MENU; break; default: // See if the input was a single ASCII key. If so it will be passed to // KeyDown to allow it to be filtered. Correct the modifiers and key // for ASCII letters as Qt uses the ASCII code of uppercase letters for // Key_A etc. utf8 = e->text().toUtf8(); if (utf8.length() != 1) key = 0; else if ((key = utf8[0]) >= 0x80) key = 0; else if (key >= 0x01 && key <= 0x1a) key += 0x40; else if (key >= 'A' && key <= 'Z') shift = true; else if (key >= 'a' && key <= 'z') { key -= 0x20; shift = false; } } if (key) { bool consumed = false; sci->KeyDown(key, shift, ctrl, alt, &consumed); if (consumed) { e->accept(); return; } } // Add the text if it has a compatible size depending on what Unicode mode // we are in. if (utf8.length() > 0 && (sci->IsUnicodeMode() || utf8.length() == 1)) { sci->AddCharUTF(utf8.data(), utf8.length()); e->accept(); } else QAbstractScrollArea::keyPressEvent(e); } // Handle composed characters. Note that this is the minumum needed to retain // the QScintilla v1 functionality. void QsciScintillaBase::inputMethodEvent(QInputMethodEvent *e) { QByteArray utf8 = e->commitString().toUtf8(); sci->AddCharUTF(utf8.data(), utf8.length()); e->accept(); } // Handle a mouse button double click. void QsciScintillaBase::mouseDoubleClickEvent(QMouseEvent *e) { if (e->button() != Qt::LeftButton) { e->ignore(); return; } setFocus(); // Make sure Scintilla will interpret this as a double-click. unsigned clickTime = sci->lastClickTime + Platform::DoubleClickTime() - 1; bool shift = e->modifiers() & Qt::ShiftModifier; bool ctrl = e->modifiers() & Qt::ControlModifier; bool alt = e->modifiers() & Qt::AltModifier; sci->ButtonDown(Point(e->x(), e->y()), clickTime, shift, ctrl, alt); // Remember the current position and time in case it turns into a triple // click. triple_click_at = e->globalPos(); triple_click.start(QApplication::doubleClickInterval()); } // Handle a mouse move. void QsciScintillaBase::mouseMoveEvent(QMouseEvent *e) { sci->ButtonMove(Point(e->x(), e->y())); } // Handle a mouse button press. void QsciScintillaBase::mousePressEvent(QMouseEvent *e) { setFocus(); Point pt(e->x(), e->y()); if (e->button() == Qt::LeftButton) { unsigned clickTime; // It is a triple click if the timer is running and the mouse hasn't // moved too much. if (triple_click.isActive() && (e->globalPos() - triple_click_at).manhattanLength() < QApplication::startDragDistance()) clickTime = sci->lastClickTime + Platform::DoubleClickTime() - 1; else clickTime = sci->lastClickTime + Platform::DoubleClickTime() + 1; triple_click.stop(); bool shift = e->modifiers() & Qt::ShiftModifier; bool ctrl = e->modifiers() & Qt::ControlModifier; bool alt = e->modifiers() & Qt::AltModifier; sci->ButtonDown(pt, clickTime, shift, ctrl, alt); } else if (e->button() == Qt::MidButton) { QClipboard *cb = QApplication::clipboard(); if (cb->supportsSelection()) { int pos = sci->PositionFromLocation(pt); sci->SetSelection(pos, pos); sci->pasteFromClipboard(QClipboard::Selection); } } } // Handle a mouse button releases. void QsciScintillaBase::mouseReleaseEvent(QMouseEvent *e) { if (sci->HaveMouseCapture() && e->button() == Qt::LeftButton) { bool ctrl = e->modifiers() & Qt::ControlModifier; sci->ButtonUp(Point(e->x(), e->y()), 0, ctrl); } } // Handle paint events. void QsciScintillaBase::paintEvent(QPaintEvent *e) { sci->paintEvent(e); } // Handle resize events. void QsciScintillaBase::resizeEvent(QResizeEvent *) { sci->ChangeSize(); } // Re-implemented to suppress the default behaviour as Scintilla works at a // more fundamental level. void QsciScintillaBase::scrollContentsBy(int, int) { } // Handle the vertical scrollbar. void QsciScintillaBase::handleVSb(int value) { sci->ScrollTo(value); } // Handle the horizontal scrollbar. void QsciScintillaBase::handleHSb(int value) { sci->HorizontalScrollTo(value); } // Handle drag enters. void QsciScintillaBase::dragEnterEvent(QDragEnterEvent *e) { QsciScintillaBase::dragMoveEvent(e); } // Handle drag leaves. void QsciScintillaBase::dragLeaveEvent(QDragLeaveEvent *) { sci->SetDragPosition(-1); } // Handle drag moves. void QsciScintillaBase::dragMoveEvent(QDragMoveEvent *e) { sci->SetDragPosition(sci->PositionFromLocation(Point(e->pos().x(), e->pos().y()))); if (sci->pdoc->IsReadOnly() || !e->mimeData()->hasText()) { e->ignore(); return; } e->acceptProposedAction(); } // Handle drops. void QsciScintillaBase::dropEvent(QDropEvent *e) { bool moving; const char *s; if (sci->pdoc->IsReadOnly() || !e->mimeData()->hasText()) { e->ignore(); return; } e->acceptProposedAction(); moving = (e->dropAction() == Qt::MoveAction && (e->source() == this || e->source() == viewport())); QByteArray ba; if (sci->IsUnicodeMode()) ba = e->mimeData()->text().toUtf8(); else ba = e->mimeData()->text().toLatin1(); s = ba.data(); sci->DropAt(sci->posDrop, s, moving, false); sci->Redraw(); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscicommand.cpp0000644000175000001440000001112111407213302023002 0ustar subzerousers// This module implements the QsciCommand class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscicommand.h" #include #include #include "Qsci/qsciscintilla.h" #include "Qsci/qsciscintillabase.h" static int convert(int key); // The ctor. QsciCommand::QsciCommand(QsciScintilla *qs, int msg, int key, int altkey, const char *desc) : qsCmd(qs), msgCmd(msg), qkey(key), qaltkey(altkey), descCmd(desc) { scikey = convert(qkey); if (scikey) qsCmd->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, scikey, msgCmd); scialtkey = convert(qaltkey); if (scialtkey) qsCmd->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, scialtkey, msgCmd); } // Bind a key to a command. void QsciCommand::setKey(int key) { bindKey(key,qkey,scikey); } // Bind an alternate key to a command. void QsciCommand::setAlternateKey(int altkey) { bindKey(altkey,qaltkey,scialtkey); } // Do the hard work of binding a key. void QsciCommand::bindKey(int key,int &qk,int &scik) { int new_scikey; // Ignore if it is invalid, allowing for the fact that we might be // unbinding it. if (key) { new_scikey = convert(key); if (!new_scikey) return; } else new_scikey = 0; if (scik) qsCmd->SendScintilla(QsciScintillaBase::SCI_CLEARCMDKEY, scik); qk = key; scik = new_scikey; if (scik) qsCmd->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, scik, msgCmd); } // See if a key is valid. bool QsciCommand::validKey(int key) { return convert(key); } // Convert a Qt character to the Scintilla equivalent. Return zero if it is // invalid. static int convert(int key) { // Convert the modifiers. int sci_mod = 0; if (key & Qt::SHIFT) sci_mod |= QsciScintillaBase::SCMOD_SHIFT; if (key & Qt::CTRL) sci_mod |= QsciScintillaBase::SCMOD_CTRL; if (key & Qt::ALT) sci_mod |= QsciScintillaBase::SCMOD_ALT; key &= ~Qt::MODIFIER_MASK; // Convert the key. int sci_key; if (key > 0x7f) switch (key) { case Qt::Key_Down: sci_key = QsciScintillaBase::SCK_DOWN; break; case Qt::Key_Up: sci_key = QsciScintillaBase::SCK_UP; break; case Qt::Key_Left: sci_key = QsciScintillaBase::SCK_LEFT; break; case Qt::Key_Right: sci_key = QsciScintillaBase::SCK_RIGHT; break; case Qt::Key_Home: sci_key = QsciScintillaBase::SCK_HOME; break; case Qt::Key_End: sci_key = QsciScintillaBase::SCK_END; break; case Qt::Key_PageUp: sci_key = QsciScintillaBase::SCK_PRIOR; break; case Qt::Key_PageDown: sci_key = QsciScintillaBase::SCK_NEXT; break; case Qt::Key_Delete: sci_key = QsciScintillaBase::SCK_DELETE; break; case Qt::Key_Insert: sci_key = QsciScintillaBase::SCK_INSERT; break; case Qt::Key_Escape: sci_key = QsciScintillaBase::SCK_ESCAPE; break; case Qt::Key_Backspace: sci_key = QsciScintillaBase::SCK_BACK; break; case Qt::Key_Tab: sci_key = QsciScintillaBase::SCK_TAB; break; case Qt::Key_Return: sci_key = QsciScintillaBase::SCK_RETURN; break; default: sci_key = 0; } else sci_key = key; if (sci_key) sci_key |= (sci_mod << 16); return sci_key; } // Return the translated user friendly description. QString QsciCommand::description() const { return qApp->translate("QsciCommand", descCmd); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexervhdl.cpp0000644000175000001440000002310511407213302023366 0ustar subzerousers// This module implements the QsciLexerVHDL class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexervhdl.h" #include #include #include // The ctor. QsciLexerVHDL::QsciLexerVHDL(QObject *parent) : QsciLexer(parent), fold_comments(true), fold_compact(true), fold_atelse(true), fold_atbegin(true), fold_atparenth(true) { } // The dtor. QsciLexerVHDL::~QsciLexerVHDL() { } // Returns the language name. const char *QsciLexerVHDL::language() const { return "VHDL"; } // Returns the lexer name. const char *QsciLexerVHDL::lexer() const { return "vhdl"; } // Return the style used for braces. int QsciLexerVHDL::braceStyle() const { return Attribute; } // Returns the foreground colour of the text for a style. QColor QsciLexerVHDL::defaultColor(int style) const { switch (style) { case Default: return QColor(0x80,0x00,0x80); case Comment: return QColor(0x00,0x7f,0x00); case CommentLine: return QColor(0x3f,0x7f,0x3f); case Number: case StandardOperator: return QColor(0x00,0x7f,0x7f); case String: return QColor(0x7f,0x00,0x7f); case UnclosedString: return QColor(0x00,0x00,0x00); case Keyword: return QColor(0x00,0x00,0x7f); case Attribute: return QColor(0x80,0x40,0x20); case StandardFunction: return QColor(0x80,0x80,0x20); case StandardPackage: return QColor(0x20,0x80,0x20); case StandardType: return QColor(0x20,0x80,0x80); case KeywordSet7: return QColor(0x80,0x40,0x20); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerVHDL::defaultEolFill(int style) const { if (style == UnclosedString) return true; return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerVHDL::defaultFont(int style) const { QFont f; switch (style) { case Comment: case CommentLine: case KeywordSet7: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerVHDL::keywords(int set) const { if (set == 1) return "access after alias all architecture array assert attribute begin " "block body buffer bus case component configuration constant " "disconnect downto else elsif end entity exit file for function " "generate generic group guarded if impure in inertial inout is " "label library linkage literal loop map new next null of on open " "others out package port postponed procedure process pure range " "record register reject report return select severity shared " "signal subtype then to transport type unaffected units until use " "variable wait when while with"; if (set == 2) return "abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor"; if (set == 3) return "left right low high ascending image value pos val succ pred " "leftof rightof base range reverse_range length delayed stable " "quiet transaction event active last_event last_active last_value " "driving driving_value simple_name path_name instance_name"; if (set == 4) return "now readline read writeline write endfile resolved to_bit " "to_bitvector to_stdulogic to_stdlogicvector to_stdulogicvector " "to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left " "shift_right rotate_left rotate_right resize to_integer " "to_unsigned to_signed std_match to_01"; if (set == 5) return "std ieee work standard textio std_logic_1164 std_logic_arith " "std_logic_misc std_logic_signed std_logic_textio " "std_logic_unsigned numeric_bit numeric_std math_complex " "math_real vital_primitives vital_timing"; if (set == 6) return "boolean bit character severity_level integer real time " "delay_length natural positive string bit_vector file_open_kind " "file_open_status line text side width std_ulogic " "std_ulogic_vector std_logic std_logic_vector X01 X01Z UX01 UX01Z " "unsigned signed"; return 0; } // Returns the user name of a style. QString QsciLexerVHDL::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Comment"); case CommentLine: return tr("Comment line"); case Number: return tr("Number"); case String: return tr("String"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case UnclosedString: return tr("Unclosed string"); case Keyword: return tr("Keyword"); case StandardOperator: return tr("Standard operator"); case Attribute: return tr("Attribute"); case StandardFunction: return tr("Standard function"); case StandardPackage: return tr("Standard package"); case StandardType: return tr("Standard type"); case KeywordSet7: return tr("User defined"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerVHDL::defaultPaper(int style) const { if (style == UnclosedString) return QColor(0xe0,0xc0,0xe0); return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerVHDL::refreshProperties() { setCommentProp(); setCompactProp(); setAtElseProp(); setAtBeginProp(); setAtParenthProp(); } // Read properties from the settings. bool QsciLexerVHDL::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_comments = qs.value(prefix + "foldcomments", true).toBool(); fold_compact = qs.value(prefix + "foldcompact", true).toBool(); fold_atelse = qs.value(prefix + "foldatelse", true).toBool(); fold_atbegin = qs.value(prefix + "foldatbegin", true).toBool(); fold_atparenth = qs.value(prefix + "foldatparenthesis", true).toBool(); return rc; } // Write properties to the settings. bool QsciLexerVHDL::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldcomments", fold_comments); qs.setValue(prefix + "foldcompact", fold_compact); qs.setValue(prefix + "foldatelse", fold_atelse); qs.setValue(prefix + "foldatbegin", fold_atbegin); qs.setValue(prefix + "foldatparenthesis", fold_atparenth); return rc; } // Return true if comments can be folded. bool QsciLexerVHDL::foldComments() const { return fold_comments; } // Set if comments can be folded. void QsciLexerVHDL::setFoldComments(bool fold) { fold_comments = fold; setCommentProp(); } // Set the "fold.comment" property. void QsciLexerVHDL::setCommentProp() { emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); } // Return true if folds are compact. bool QsciLexerVHDL::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerVHDL::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerVHDL::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } // Return true if else blocks can be folded. bool QsciLexerVHDL::foldAtElse() const { return fold_atelse; } // Set if else blocks can be folded. void QsciLexerVHDL::setFoldAtElse(bool fold) { fold_atelse = fold; setAtElseProp(); } // Set the "fold.at.else" property. void QsciLexerVHDL::setAtElseProp() { emit propertyChanged("fold.at.else",(fold_atelse ? "1" : "0")); } // Return true if begin blocks can be folded. bool QsciLexerVHDL::foldAtBegin() const { return fold_atbegin; } // Set if begin blocks can be folded. void QsciLexerVHDL::setFoldAtBegin(bool fold) { fold_atbegin = fold; setAtBeginProp(); } // Set the "fold.at.Begin" property. void QsciLexerVHDL::setAtBeginProp() { emit propertyChanged("fold.at.Begin",(fold_atelse ? "1" : "0")); } // Return true if blocks can be folded at a parenthesis. bool QsciLexerVHDL::foldAtParenthesis() const { return fold_atparenth; } // Set if blocks can be folded at a parenthesis. void QsciLexerVHDL::setFoldAtParenthesis(bool fold) { fold_atparenth = fold; setAtParenthProp(); } // Set the "fold.at.Parenthese" property. void QsciLexerVHDL::setAtParenthProp() { emit propertyChanged("fold.at.Parenthese",(fold_atparenth ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerjavascript.cpp0000644000175000001440000000610511407213302024600 0ustar subzerousers// This module implements the QsciLexerJavaScript class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerjavascript.h" #include #include // The list of JavaScript keywords that can be used by other friendly lexers. const char *QsciLexerJavaScript::keywordClass = "abstract boolean break byte case catch char class const continue " "debugger default delete do double else enum export extends final " "finally float for function goto if implements import in instanceof " "int interface long native new package private protected public " "return short static super switch synchronized this throw throws " "transient try typeof var void volatile while with"; // The ctor. QsciLexerJavaScript::QsciLexerJavaScript(QObject *parent) : QsciLexerCPP(parent) { } // The dtor. QsciLexerJavaScript::~QsciLexerJavaScript() { } // Returns the language name. const char *QsciLexerJavaScript::language() const { return "JavaScript"; } // Returns the foreground colour of the text for a style. QColor QsciLexerJavaScript::defaultColor(int style) const { if (style == Regex) return QColor(0x3f,0x7f,0x3f); return QsciLexerCPP::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerJavaScript::defaultEolFill(int style) const { if (style == Regex) return true; return QsciLexerCPP::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerJavaScript::defaultFont(int style) const { if (style == Regex) #if defined(Q_OS_WIN) return QFont("Courier New",10); #else return QFont("Bitstream Vera Sans Mono",9); #endif return QsciLexerCPP::defaultFont(style); } // Returns the set of keywords. const char *QsciLexerJavaScript::keywords(int set) const { if (set != 1) return 0; return keywordClass; } // Returns the user name of a style. QString QsciLexerJavaScript::description(int style) const { if (style == Regex) return tr("Regular expression"); return QsciLexerCPP::description(style); } // Returns the background colour of the text for a style. QColor QsciLexerJavaScript::defaultPaper(int style) const { if (style == Regex) return QColor(0xe0,0xf0,0xff); return QsciLexer::defaultPaper(style); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qsciapis.cpp0000644000175000001440000005676711407213302022351 0ustar subzerousers// This module implements the QsciAPIs class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include "Qsci/qsciapis.h" #include #include #include #include #include #include #include #include #include #include "Qsci/qscilexer.h" // The version number of the prepared API information format. const unsigned char PreparedDataFormatVersion = 0; // This class contains prepared API information. struct QsciAPIsPrepared { // The word dictionary is a map of individual words and a list of positions // each occurs in the sorted list of APIs. A position is a tuple of the // index into the list of APIs and the index into the particular API. QMap wdict; // The case dictionary maps the case insensitive words to the form in which // they are to be used. It is only used if the language is case // insensitive. QMap cdict; // The raw API information. QStringList raw_apis; QStringList apiWords(int api_idx, const QStringList &wseps) const; static QString apiBaseName(const QString &api); }; // Return a particular API entry as a list of words. QStringList QsciAPIsPrepared::apiWords(int api_idx, const QStringList &wseps) const { QString base = apiBaseName(raw_apis[api_idx]); if (wseps.isEmpty()) return QStringList(base); return base.split(wseps.first()); } // Return the name of an API function, ie. without the arguments. QString QsciAPIsPrepared::apiBaseName(const QString &api) { QString base = api; int tail = base.indexOf('('); if (tail >= 0) base.truncate(tail); return base; } // The user event type that signals that the worker thread has started. const QEvent::Type WorkerStarted = static_cast(QEvent::User + 1012); // The user event type that signals that the worker thread has finished. const QEvent::Type WorkerFinished = static_cast(QEvent::User + 1013); // The user event type that signals that the worker thread has aborted. const QEvent::Type WorkerAborted = static_cast(QEvent::User + 1014); // This class is the worker thread that post-processes the API set. class QsciAPIsWorker : public QThread { public: QsciAPIsWorker(QsciAPIs *apis); virtual ~QsciAPIsWorker(); virtual void run(); QsciAPIsPrepared *prepared; private: QsciAPIs *proxy; bool abort; }; // The worker thread ctor. QsciAPIsWorker::QsciAPIsWorker(QsciAPIs *apis) : proxy(apis), prepared(0), abort(false) { } // The worker thread dtor. QsciAPIsWorker::~QsciAPIsWorker() { // Tell the thread to stop. There is no need to bother with a mutex. abort = true; // Wait for it to do so and hit it if it doesn't. if (!wait(500)) terminate(); if (prepared) delete prepared; } // The worker thread entry point. void QsciAPIsWorker::run() { // Sanity check. if (!prepared) return; // Tell the main thread we have started. QApplication::postEvent(proxy, new QEvent(WorkerStarted)); // Sort the full list. prepared->raw_apis.sort(); QStringList wseps = proxy->lex->autoCompletionWordSeparators(); bool cs = proxy->lex->caseSensitive(); // Split each entry into separate words but ignoring any arguments. for (int a = 0; a < prepared->raw_apis.count(); ++a) { // Check to see if we should stop. if (abort) break; QStringList words = prepared->apiWords(a, wseps); for (int w = 0; w < words.count(); ++w) { const QString &word = words[w]; // Add the word's position to any existing list for this word. QsciAPIs::WordIndexList wil = prepared->wdict[word]; // If the language is case insensitive and we haven't seen this // word before then save it in the case dictionary. if (!cs && wil.count() == 0) prepared->cdict[word.toUpper()] = word; wil.append(QsciAPIs::WordIndex(a, w)); prepared->wdict[word] = wil; } } // Tell the main thread we have finished. QApplication::postEvent(proxy, new QEvent(abort ? WorkerAborted : WorkerFinished)); } // The ctor. QsciAPIs::QsciAPIs(QsciLexer *lexer) : QObject(lexer), lex(lexer), worker(0), ctcursor(0), origin_len(0) { prep = new QsciAPIsPrepared; lexer->setAPIs(this); } // The dtor. QsciAPIs::~QsciAPIs() { deleteWorker(); delete prep; } // Delete the worker thread if there is one. void QsciAPIs::deleteWorker() { if (worker) { delete worker; worker = 0; } } //! Handle termination events from the worker thread. bool QsciAPIs::event(QEvent *e) { switch (e->type()) { case WorkerStarted: emit apiPreparationStarted(); return true; case WorkerAborted: deleteWorker(); emit apiPreparationCancelled(); return true; case WorkerFinished: delete prep; old_context.clear(); prep = worker->prepared; worker->prepared = 0; deleteWorker(); // Allow the raw API information to be modified. apis = prep->raw_apis; emit apiPreparationFinished(); return true; } return QObject::event(e); } // Clear the current raw API entries. void QsciAPIs::clear() { apis.clear(); } // Clear out all API information. bool QsciAPIs::load(const QString &fname) { QFile f(fname); if (!f.open(QIODevice::ReadOnly)) return false; QTextStream ts(&f); for (;;) { QString line = ts.readLine(); if (line.isEmpty()) break; apis.append(line); } return true; } // Add a single API entry. void QsciAPIs::add(const QString &entry) { apis.append(entry); } // Remove a single API entry. void QsciAPIs::remove(const QString &entry) { int idx = apis.indexOf(entry); if (idx >= 0) apis.removeAt(idx); } // Position the "origin" cursor into the API entries according to the user // supplied context. QStringList QsciAPIs::positionOrigin(const QStringList &context, QString &path) { // Get the list of words and see if the context is the same as last time we // were called. QStringList new_context; bool same_context = (old_context.count() > 0 && old_context.count() < context.count()); for (int i = 0; i < context.count(); ++i) { QString word = context[i]; if (!lex->caseSensitive()) word = word.toUpper(); if (i < old_context.count() && old_context[i] != word) same_context = false; new_context << word; } // If the context has changed then reset the origin. if (!same_context) origin_len = 0; // If we have a current origin (ie. the user made a specific selection in // the current context) then adjust the origin to include the last complete // word as the user may have entered more parts of the name without using // auto-completion. if (origin_len > 0) { const QString wsep = lex->autoCompletionWordSeparators().first(); int start_new = old_context.count(); int end_new = new_context.count() - 1; QString fixed = *origin; fixed.truncate(origin_len); path = fixed; while (start_new < end_new) { // Add this word to the current path. path.append(wsep); path.append(new_context[start_new]); origin_len = path.length(); // Skip entries in the current origin that don't match the path. while (origin != prep->raw_apis.end()) { // See if the current origin has come to an end. if (!originStartsWith(fixed, wsep)) origin = prep->raw_apis.end(); else if (originStartsWith(path, wsep)) break; else ++origin; } if (origin == prep->raw_apis.end()) break; ++start_new; } // If the new text wasn't recognised then reset the origin. if (origin == prep->raw_apis.end()) origin_len = 0; } if (origin_len == 0) path.truncate(0); // Save the "committed" context for next time. old_context = new_context; old_context.removeLast(); return new_context; } // Return true if the origin starts with the given path. bool QsciAPIs::originStartsWith(const QString &path, const QString &wsep) { const QString &orig = *origin; if (!orig.startsWith(path)) return false; // Check that the path corresponds to the end of a word, ie. that what // follows in the origin is either a word separator or a (. QString tail = orig.mid(path.length()); return (tail.startsWith(wsep) || tail.at(0) == '('); } // Add auto-completion words to an existing list. void QsciAPIs::autoCompletionList(const QStringList &context, QStringList &wlist) { QString path; QStringList new_context = positionOrigin(context, path); if (origin_len > 0) { const QString wsep = lex->autoCompletionWordSeparators().first(); QStringList::const_iterator it = origin; unambiguous_context = path; while (it != prep->raw_apis.end()) { QString base = QsciAPIsPrepared::apiBaseName(*it); if (!base.startsWith(path)) break; // Make sure we have something after the path. if (base != path) { // Get the word we are interested in (ie. the one after the // current origin in path). QString w = base.mid(origin_len + wsep.length()).split(wsep).first(); // Append the space, we know the origin is unambiguous. w.append(' '); if (!wlist.contains(w)) wlist << w; } ++it; } } else { // At the moment we assume we will add words from multiple contexts. unambiguous_context.truncate(0); bool unambig = true; QStringList with_context; if (new_context.last().isEmpty()) lastCompleteWord(new_context[new_context.count() - 2], with_context, unambig); else lastPartialWord(new_context.last(), with_context, unambig); for (int i = 0; i < with_context.count(); ++i) { // Remove any unambigious context. QString noc = with_context[i]; if (unambig) { int op = noc.indexOf('('); if (op >= 0) noc.truncate(op); } wlist << noc; } } } // Get the index list for a particular word if there is one. const QsciAPIs::WordIndexList *QsciAPIs::wordIndexOf(const QString &word) const { QString csword; // Indirect through the case dictionary if the language isn't case // sensitive. if (lex->caseSensitive()) csword = word; else { csword = prep->cdict[word]; if (csword.isEmpty()) return 0; } // Get the possible API entries if any. const WordIndexList *wl = &prep->wdict[csword]; if (wl->isEmpty()) return 0; return wl; } // Add auto-completion words based on the last complete word entered. void QsciAPIs::lastCompleteWord(const QString &word, QStringList &with_context, bool &unambig) { // Get the possible API entries if any. const WordIndexList *wl = wordIndexOf(word); if (wl) addAPIEntries(*wl, true, with_context, unambig); } // Add auto-completion words based on the last partial word entered. void QsciAPIs::lastPartialWord(const QString &word, QStringList &with_context, bool &unambig) { if (lex->caseSensitive()) { QMap::const_iterator it = prep->wdict.lowerBound(word); while (it != prep->wdict.end()) { if (!it.key().startsWith(word)) break; addAPIEntries(it.value(), false, with_context, unambig); ++it; } } else { QMap::const_iterator it = prep->cdict.lowerBound(word); while (it != prep->cdict.end()) { if (!it.key().startsWith(word)) break; addAPIEntries(prep->wdict[it.value()], false, with_context, unambig); ++it; } } } // Handle the selection of an entry in the auto-completion list. void QsciAPIs::autoCompletionSelected(const QString &sel) { // If the selection is an API (ie. it has a space separating the selected // word and the optional origin) then remember the origin. QStringList lst = sel.split(' '); if (lst.count() != 2) { origin_len = 0; return; } const QString &path = lst[1]; QString owords; if (path.isEmpty()) owords = unambiguous_context; else { // Check the parenthesis. if (!path.startsWith("(") || !path.endsWith(")")) { origin_len = 0; return; } // Remove the parenthesis. owords = path.mid(1, path.length() - 2); } origin = qLowerBound(prep->raw_apis, owords); origin_len = owords.length(); } // Add auto-completion words for a particular word (defined by where it appears // in the APIs) and depending on whether the word was complete (when it's // actually the next word in the API entry that is of interest) or not. void QsciAPIs::addAPIEntries(const WordIndexList &wl, bool complete, QStringList &with_context, bool &unambig) { QStringList wseps = lex->autoCompletionWordSeparators(); for (int w = 0; w < wl.count(); ++w) { const WordIndex &wi = wl[w]; QStringList api_words = prep->apiWords(wi.first, wseps); int idx = wi.second; if (complete) { // Skip if this is the last word. if (++idx >= api_words.count()) continue; } QString api_word; if (idx == 0) api_word = api_words[0] + ' '; else { QStringList orgl = api_words.mid(0, idx); QString org = orgl.join(wseps.first()); api_word = QString("%1 (%2)").arg(api_words[idx]).arg(org); // See if the origin has been used before. if (unambig) if (unambiguous_context.isEmpty()) unambiguous_context = org; else if (unambiguous_context != org) { unambiguous_context.truncate(0); unambig = false; } } if (!with_context.contains(api_word)) with_context.append(api_word); } } // Return the call tip for a function. QString QsciAPIs::callTips(const QStringList &context, QsciScintilla::CallTipsStyle style, int maxnr, int commas, int &ctshift) { QString path; QStringList new_context = positionOrigin(context, path); QStringList wseps = lex->autoCompletionWordSeparators(); QStringList cts; if (origin_len > 0) { QStringList::const_iterator it = origin; QString prev; // Work out the lenght of the context. const QString &wsep = wseps.first(); QStringList strip = path.split(wsep); strip.removeLast(); int ctstart = strip.join(wsep).length(); if (ctstart) ctstart += wsep.length(); int shift; if (style == QsciScintilla::CallTipsContext) { shift = ctstart; ctstart = 0; } else shift = 0; // Make sure we only look at the functions we are interested in. path.append('('); while (it != prep->raw_apis.end() && (*it).startsWith(path)) { if (maxnr > 0 && maxnr == cts.count()) break; QString w = (*it).mid(ctstart); if (w != prev && enoughCommas(w, commas)) { ctshifts << shift; cts << w; prev = w; } ++it; } } else { const QString &fname = new_context[new_context.count() - 2]; // Find everywhere the function name appears in the APIs. const WordIndexList *wil = wordIndexOf(fname); if (wil) for (int i = 0; i < wil->count(); ++i) { const WordIndex &wi = (*wil)[i]; QStringList awords = prep->apiWords(wi.first, wseps); // Check the word is the function name and not part of any // context. if (wi.second != awords.count() - 1) continue; const QString &api = prep->raw_apis[wi.first]; int tail = api.indexOf('('); if (tail < 0) continue; if (!enoughCommas(api, commas)) continue; if (maxnr > 0 && maxnr == cts.count()) break; if (style == QsciScintilla::CallTipsNoContext) { ctshifts << 0; cts << (fname + api.mid(tail)); } else { ctshifts << tail - fname.length(); cts << api; } } } // See if we want to add a down arrow. if (maxnr < 0 && cts.count() > 1) { // Remember the state so we can scroll through it later. ctlist = cts; ctcursor = 0; QString ct = cts[0]; ct.prepend('\002'); ctshift = ctshifts.first(); return ct; } // Find the biggest shift. ctshift = 0; for (int i = 0; i < ctshifts.count(); ++i) { int shift = ctshifts[i]; if (ctshift < shift) ctshift = shift; } ctshifts.clear(); ctlist.clear(); return cts.join("\n"); } // Return the next or previous call tip. QString QsciAPIs::callTipsNextPrev(int dir, int &ctshift) { QString ct; // Get the call tip. if (dir == 1 && ctcursor > 0) ct = ctlist[--ctcursor]; else if (dir == 2 && ctcursor < ctlist.count() - 1) ct = ctlist[++ctcursor]; // Add the arrows. if (!ct.isEmpty()) { if (ctcursor < ctlist.count() - 1) ct.prepend('\002'); if (ctcursor > 0) ct.prepend('\001'); ctshift = ctshifts[ctcursor]; } return ct; } // Return true if a string has enough commas in the argument list. bool QsciAPIs::enoughCommas(const QString &s, int commas) { int end = s.indexOf(')'); if (end < 0) return false; QString w = s.left(end); return (w.count(',') >= commas); } // Ensure the list is ready. void QsciAPIs::prepare() { // Handle the trivial case. if (worker) return; QsciAPIsPrepared *new_apis = new QsciAPIsPrepared; new_apis->raw_apis = apis; worker = new QsciAPIsWorker(this); worker->prepared = new_apis; worker->start(); } // Cancel any current preparation. void QsciAPIs::cancelPreparation() { deleteWorker(); } // Check that a prepared API file exists. bool QsciAPIs::isPrepared(const QString &fname) const { QString pname = prepName(fname); if (pname.isEmpty()) return false; QFileInfo fi(pname); return fi.exists(); } // Load the prepared API information. bool QsciAPIs::loadPrepared(const QString &fname) { QString pname = prepName(fname); if (pname.isEmpty()) return false; // Read the prepared data and decompress it. QFile pf(pname); if (!pf.open(QIODevice::ReadOnly)) return false; QByteArray cpdata = pf.readAll(); pf.close(); if (cpdata.count() == 0) return false; QByteArray pdata = qUncompress(cpdata); // Extract the data. QDataStream pds(pdata); unsigned char vers; pds >> vers; if (vers > PreparedDataFormatVersion) return false; char *lex_name; pds >> lex_name; if (qstrcmp(lex_name, lex->lexer()) != 0) { delete[] lex_name; return false; } delete[] lex_name; prep->wdict.clear(); pds >> prep->wdict; if (!lex->caseSensitive()) { // Build up the case dictionary. prep->cdict.clear(); QMap::const_iterator it = prep->wdict.begin(); while (it != prep->wdict.end()) { prep->cdict[it.key().toUpper()] = it.key(); ++it; } } prep->raw_apis.clear(); pds >> prep->raw_apis; // Allow the raw API information to be modified. apis = prep->raw_apis; return true; } // Save the prepared API information. bool QsciAPIs::savePrepared(const QString &fname) const { QString pname = prepName(fname, true); if (pname.isEmpty()) return false; // Write the prepared data to a memory buffer. QByteArray pdata; QDataStream pds(&pdata, QIODevice::WriteOnly); // Use a serialisation format supported by Qt v3.0 and later. pds.setVersion(QDataStream::Qt_3_0); pds << PreparedDataFormatVersion; pds << lex->lexer(); pds << prep->wdict; pds << prep->raw_apis; // Compress the data and write it. QFile pf(pname); if (!pf.open(QIODevice::WriteOnly|QIODevice::Truncate)) return false; if (pf.write(qCompress(pdata)) < 0) { pf.close(); return false; } pf.close(); return true; } // Return the name of the default prepared API file. QString QsciAPIs::defaultPreparedName() const { return prepName(QString()); } // Return the name of a prepared API file. QString QsciAPIs::prepName(const QString &fname, bool mkpath) const { // Handle the tivial case. if (!fname.isEmpty()) return fname; QString pdname; char *qsci = getenv("QSCIDIR"); if (qsci) pdname = qsci; else { static const char *qsci_dir = ".qsci"; QDir pd = QDir::home(); if (mkpath && !pd.exists(qsci_dir) && !pd.mkdir(qsci_dir)) return QString(); pdname = pd.filePath(qsci_dir); } return QString("%1/%2.pap").arg(pdname).arg(lex->lexer()); } // Return installed API files. QStringList QsciAPIs::installedAPIFiles() const { QString qtdir = QLibraryInfo::location(QLibraryInfo::DataPath); QDir apidir = QDir(QString("%1/qsci/api/%2").arg(qtdir).arg(lex->lexer())); QStringList fnames; QStringList filters; filters << "*.api"; QFileInfoList flist = apidir.entryInfoList(filters, QDir::Files, QDir::IgnoreCase); foreach (QFileInfo fi, flist) fnames << fi.absoluteFilePath(); return fnames; } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexerd.cpp0000644000175000001440000002302311407213302022653 0ustar subzerousers// This module implements the QsciLexerD class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexerd.h" #include #include #include // The ctor. QsciLexerD::QsciLexerD(QObject *parent) : QsciLexer(parent), fold_atelse(false), fold_comments(false), fold_compact(true) { } // The dtor. QsciLexerD::~QsciLexerD() { } // Returns the language name. const char *QsciLexerD::language() const { return "D"; } // Returns the lexer name. const char *QsciLexerD::lexer() const { return "d"; } // Return the set of character sequences that can separate auto-completion // words. QStringList QsciLexerD::autoCompletionWordSeparators() const { QStringList wl; wl << "."; return wl; } // Return the list of keywords that can start a block. const char *QsciLexerD::blockStartKeyword(int *style) const { if (style) *style = Keyword; return "case catch class default do else finally for foreach " "foreach_reverse if private protected public struct try union " "while"; } // Return the list of characters that can start a block. const char *QsciLexerD::blockStart(int *style) const { if (style) *style = Operator; return "{"; } // Return the list of characters that can end a block. const char *QsciLexerD::blockEnd(int *style) const { if (style) *style = Operator; return "}"; } // Return the style used for braces. int QsciLexerD::braceStyle() const { return Operator; } // Return the string of characters that comprise a word. const char *QsciLexerD::wordCharacters() const { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#"; } // Returns the foreground colour of the text for a style. QColor QsciLexerD::defaultColor(int style) const { switch (style) { case Default: return QColor(0x80,0x80,0x80); case Comment: case CommentLine: return QColor(0x00,0x7f,0x00); case CommentDoc: case CommentLineDoc: return QColor(0x3f,0x70,0x3f); case CommentNested: return QColor(0xa0,0xc0,0xa0); case Number: return QColor(0x00,0x7f,0x7f); case Keyword: case KeywordSecondary: case KeywordDoc: case Typedefs: return QColor(0x00,0x00,0x7f); case String: return QColor(0x7f,0x00,0x7f); case Character: return QColor(0x7f,0x00,0x7f); case Operator: case UnclosedString: return QColor(0x00,0x00,0x00); case Identifier: break; case CommentDocKeyword: return QColor(0x30,0x60,0xa0); case CommentDocKeywordError: return QColor(0x80,0x40,0x20); } return QsciLexer::defaultColor(style); } // Returns the end-of-line fill for a style. bool QsciLexerD::defaultEolFill(int style) const { if (style == UnclosedString) return true; return QsciLexer::defaultEolFill(style); } // Returns the font of the text for a style. QFont QsciLexerD::defaultFont(int style) const { QFont f; switch (style) { case Comment: case CommentLine: case CommentDoc: case CommentNested: case CommentLineDoc: case CommentDocKeyword: case CommentDocKeywordError: #if defined(Q_OS_WIN) f = QFont("Comic Sans MS",9); #else f = QFont("Bitstream Vera Serif",9); #endif break; case Keyword: case KeywordSecondary: case KeywordDoc: case Typedefs: case Operator: f = QsciLexer::defaultFont(style); f.setBold(true); break; case String: case UnclosedString: #if defined(Q_OS_WIN) f = QFont("Courier New",10); #else f = QFont("Bitstream Vera Sans Mono",9); #endif break; default: f = QsciLexer::defaultFont(style); } return f; } // Returns the set of keywords. const char *QsciLexerD::keywords(int set) const { if (set == 1) return "abstract alias align asm assert auto body bool break byte case " "cast catch cdouble cent cfloat char class const continue creal " "dchar debug default delegate delete deprecated do double else " "enum export extern false final finally float for foreach " "foreach_reverse function goto idouble if ifloat import in inout " "int interface invariant ireal is lazy long mixin module new null " "out override package pragma private protected public real return " "scope short static struct super switch synchronized template " "this throw true try typedef typeid typeof ubyte ucent uint ulong " "union unittest ushort version void volatile wchar while with"; if (set == 3) return "a addindex addtogroup anchor arg attention author b brief bug c " "class code date def defgroup deprecated dontinclude e em endcode " "endhtmlonly endif endlatexonly endlink endverbatim enum example " "exception f$ f[ f] file fn hideinitializer htmlinclude htmlonly " "if image include ingroup internal invariant interface latexonly " "li line link mainpage name namespace nosubgrouping note overload " "p page par param post pre ref relates remarks return retval sa " "section see showinitializer since skip skipline struct " "subsection test throw todo typedef union until var verbatim " "verbinclude version warning weakgroup $ @ \\ & < > # { }"; return 0; } // Returns the user name of a style. QString QsciLexerD::description(int style) const { switch (style) { case Default: return tr("Default"); case Comment: return tr("Block comment"); case CommentLine: return tr("Line comment"); case CommentDoc: return tr("DDoc style block comment"); case CommentNested: return tr("Nesting comment"); case Number: return tr("Number"); case Keyword: return tr("Keyword"); case KeywordSecondary: return tr("Secondary keyword"); case KeywordDoc: return tr("Documentation keyword"); case Typedefs: return tr("Type definition"); case String: return tr("String"); case UnclosedString: return tr("Unclosed string"); case Character: return tr("Character"); case Operator: return tr("Operator"); case Identifier: return tr("Identifier"); case CommentLineDoc: return tr("DDoc style line comment"); case CommentDocKeyword: return tr("DDoc keyword"); case CommentDocKeywordError: return tr("DDoc keyword error"); } return QString(); } // Returns the background colour of the text for a style. QColor QsciLexerD::defaultPaper(int style) const { if (style == UnclosedString) return QColor(0xe0,0xc0,0xe0); return QsciLexer::defaultPaper(style); } // Refresh all properties. void QsciLexerD::refreshProperties() { setAtElseProp(); setCommentProp(); setCompactProp(); } // Read properties from the settings. bool QsciLexerD::readProperties(QSettings &qs,const QString &prefix) { int rc = true; fold_atelse = qs.value(prefix + "foldatelse", false).toBool(); fold_comments = qs.value(prefix + "foldcomments", false).toBool(); fold_compact = qs.value(prefix + "foldcompact", true).toBool(); return rc; } // Write properties to the settings. bool QsciLexerD::writeProperties(QSettings &qs,const QString &prefix) const { int rc = true; qs.setValue(prefix + "foldatelse", fold_atelse); qs.setValue(prefix + "foldcomments", fold_comments); qs.setValue(prefix + "foldcompact", fold_compact); return rc; } // Return true if else can be folded. bool QsciLexerD::foldAtElse() const { return fold_atelse; } // Set if else can be folded. void QsciLexerD::setFoldAtElse(bool fold) { fold_atelse = fold; setAtElseProp(); } // Set the "fold.at.else" property. void QsciLexerD::setAtElseProp() { emit propertyChanged("fold.at.else",(fold_atelse ? "1" : "0")); } // Return true if comments can be folded. bool QsciLexerD::foldComments() const { return fold_comments; } // Set if comments can be folded. void QsciLexerD::setFoldComments(bool fold) { fold_comments = fold; setCommentProp(); } // Set the "fold.comment" property. void QsciLexerD::setCommentProp() { emit propertyChanged("fold.comment",(fold_comments ? "1" : "0")); } // Return true if folds are compact. bool QsciLexerD::foldCompact() const { return fold_compact; } // Set if folds are compact void QsciLexerD::setFoldCompact(bool fold) { fold_compact = fold; setCompactProp(); } // Set the "fold.compact" property. void QsciLexerD::setCompactProp() { emit propertyChanged("fold.compact",(fold_compact ? "1" : "0")); } sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/SciClasses.h0000644000175000001440000000444511407213302022220 0ustar subzerousers// The definition of various Qt version independent classes used by the rest of // the port. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _SCICLASSES_H #define _SCICLASSES_H #include #include class QMouseEvent; class QPaintEvent; class ScintillaQt; // A simple QWidget sub-class to implement a call tip. class SciCallTip : public QWidget { Q_OBJECT public: SciCallTip(QWidget *parent, ScintillaQt *sci_); ~SciCallTip(); protected: void paintEvent(QPaintEvent *e); void mousePressEvent(QMouseEvent *e); private: ScintillaQt *sci; }; // A popup menu where options correspond to a numeric command. #include #include class SciPopup : public QMenu { Q_OBJECT public: SciPopup(); void addItem(const QString &label, int cmd, bool enabled, ScintillaQt *sci_); private slots: void on_triggered(int cmd); private: ScintillaQt *sci; QSignalMapper mapper; }; // This sub-class of QListBox is needed to provide slots from which we can call // ListBox's double-click callback. (And you thought this was a C++ program.) class ListBoxQt; #include class SciListBox : public QListWidget { Q_OBJECT public: SciListBox(QWidget *parent, ListBoxQt *lbx_); virtual ~SciListBox(); void addItemPixmap(const QPixmap &pm, const QString &txt); int find(const QString &prefix); QString text(int n); private slots: void handleDoubleClick(); private: ListBoxQt *lbx; }; #endif sqliteman-1.2.2/sqliteman/qscintilla2/Qt4/qscilexeridl.cpp0000644000175000001440000000705011407213302023202 0ustar subzerousers// This module implements the QsciLexerIDL class. // // Copyright (c) 2007 // Phil Thompson // // This file is part of QScintilla. // // This copy of QScintilla is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) any // later version. // // QScintilla is supplied in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more // details. // // You should have received a copy of the GNU General Public License along with // QScintilla; see the file LICENSE. If not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Qsci/qscilexeridl.h" #include #include // The ctor. QsciLexerIDL::QsciLexerIDL(QObject *parent) : QsciLexerCPP(parent) { } // The dtor. QsciLexerIDL::~QsciLexerIDL() { } // Returns the language name. const char *QsciLexerIDL::language() const { return "IDL"; } // Returns the foreground colour of the text for a style. QColor QsciLexerIDL::defaultColor(int style) const { if (style == UUID) return QColor(0x80,0x40,0x80); return QsciLexerCPP::defaultColor(style); } // Returns the set of keywords. const char *QsciLexerIDL::keywords(int set) const { if (set != 1) return 0; return "aggregatable allocate appobject arrays async async_uuid " "auto_handle bindable boolean broadcast byte byte_count " "call_as callback char coclass code comm_status const " "context_handle context_handle_noserialize " "context_handle_serialize control cpp_quote custom decode " "default defaultbind defaultcollelem defaultvalue " "defaultvtable dispinterface displaybind dllname double dual " "enable_allocate encode endpoint entry enum error_status_t " "explicit_handle fault_status first_is float handle_t heap " "helpcontext helpfile helpstring helpstringcontext " "helpstringdll hidden hyper id idempotent ignore iid_as iid_is " "immediatebind implicit_handle import importlib in include " "in_line int __int64 __int3264 interface last_is lcid " "length_is library licensed local long max_is maybe message " "methods midl_pragma midl_user_allocate midl_user_free min_is " "module ms_union ncacn_at_dsp ncacn_dnet_nsp ncacn_http " "ncacn_ip_tcp ncacn_nb_ipx ncacn_nb_nb ncacn_nb_tcp ncacn_np " "ncacn_spx ncacn_vns_spp ncadg_ip_udp ncadg_ipx ncadg_mq " "ncalrpc nocode nonbrowsable noncreatable nonextensible notify " "object odl oleautomation optimize optional out out_of_line " "pipe pointer_default pragma properties propget propput " "propputref ptr public range readonly ref represent_as " "requestedit restricted retval shape short signed size_is " "small source strict_context_handle string struct switch " "switch_is switch_type transmit_as typedef uidefault union " "unique unsigned user_marshal usesgetlasterror uuid v1_enum " "vararg version void wchar_t wire_marshal"; } // Returns the user name of a style. QString QsciLexerIDL::description(int style) const { if (style == UUID) return tr("UUID"); return QsciLexerCPP::description(style); } sqliteman-1.2.2/sqliteman/qscintilla2/include/0000755000175000001440000000000011407213302020757 5ustar subzerouserssqliteman-1.2.2/sqliteman/qscintilla2/include/SciLexer.h0000644000175000001440000007645411407213302022666 0ustar subzerousers// Scintilla source code edit control /** @file SciLexer.h ** Interface to the added lexer functions in the SciLexer version of the edit control. **/ // Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. // Most of this file is automatically generated from the Scintilla.iface interface definition // file which contains any comments about the definitions. HFacer.py does the generation. #ifndef SCILEXER_H #define SCILEXER_H // SciLexer features - not in standard Scintilla //++Autogenerated -- start of section automatically generated from Scintilla.iface #define SCLEX_CONTAINER 0 #define SCLEX_NULL 1 #define SCLEX_PYTHON 2 #define SCLEX_CPP 3 #define SCLEX_HTML 4 #define SCLEX_XML 5 #define SCLEX_PERL 6 #define SCLEX_SQL 7 #define SCLEX_VB 8 #define SCLEX_PROPERTIES 9 #define SCLEX_ERRORLIST 10 #define SCLEX_MAKEFILE 11 #define SCLEX_BATCH 12 #define SCLEX_XCODE 13 #define SCLEX_LATEX 14 #define SCLEX_LUA 15 #define SCLEX_DIFF 16 #define SCLEX_CONF 17 #define SCLEX_PASCAL 18 #define SCLEX_AVE 19 #define SCLEX_ADA 20 #define SCLEX_LISP 21 #define SCLEX_RUBY 22 #define SCLEX_EIFFEL 23 #define SCLEX_EIFFELKW 24 #define SCLEX_TCL 25 #define SCLEX_NNCRONTAB 26 #define SCLEX_BULLANT 27 #define SCLEX_VBSCRIPT 28 #define SCLEX_BAAN 31 #define SCLEX_MATLAB 32 #define SCLEX_SCRIPTOL 33 #define SCLEX_ASM 34 #define SCLEX_CPPNOCASE 35 #define SCLEX_FORTRAN 36 #define SCLEX_F77 37 #define SCLEX_CSS 38 #define SCLEX_POV 39 #define SCLEX_LOUT 40 #define SCLEX_ESCRIPT 41 #define SCLEX_PS 42 #define SCLEX_NSIS 43 #define SCLEX_MMIXAL 44 #define SCLEX_CLW 45 #define SCLEX_CLWNOCASE 46 #define SCLEX_LOT 47 #define SCLEX_YAML 48 #define SCLEX_TEX 49 #define SCLEX_METAPOST 50 #define SCLEX_POWERBASIC 51 #define SCLEX_FORTH 52 #define SCLEX_ERLANG 53 #define SCLEX_OCTAVE 54 #define SCLEX_MSSQL 55 #define SCLEX_VERILOG 56 #define SCLEX_KIX 57 #define SCLEX_GUI4CLI 58 #define SCLEX_SPECMAN 59 #define SCLEX_AU3 60 #define SCLEX_APDL 61 #define SCLEX_BASH 62 #define SCLEX_ASN1 63 #define SCLEX_VHDL 64 #define SCLEX_CAML 65 #define SCLEX_BLITZBASIC 66 #define SCLEX_PUREBASIC 67 #define SCLEX_HASKELL 68 #define SCLEX_PHPSCRIPT 69 #define SCLEX_TADS3 70 #define SCLEX_REBOL 71 #define SCLEX_SMALLTALK 72 #define SCLEX_FLAGSHIP 73 #define SCLEX_CSOUND 74 #define SCLEX_FREEBASIC 75 #define SCLEX_INNOSETUP 76 #define SCLEX_OPAL 77 #define SCLEX_SPICE 78 #define SCLEX_D 79 #define SCLEX_CMAKE 80 #define SCLEX_GAP 81 #define SCLEX_PLM 82 #define SCLEX_PROGRESS 83 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 #define SCE_P_NUMBER 2 #define SCE_P_STRING 3 #define SCE_P_CHARACTER 4 #define SCE_P_WORD 5 #define SCE_P_TRIPLE 6 #define SCE_P_TRIPLEDOUBLE 7 #define SCE_P_CLASSNAME 8 #define SCE_P_DEFNAME 9 #define SCE_P_OPERATOR 10 #define SCE_P_IDENTIFIER 11 #define SCE_P_COMMENTBLOCK 12 #define SCE_P_STRINGEOL 13 #define SCE_P_WORD2 14 #define SCE_P_DECORATOR 15 #define SCE_C_DEFAULT 0 #define SCE_C_COMMENT 1 #define SCE_C_COMMENTLINE 2 #define SCE_C_COMMENTDOC 3 #define SCE_C_NUMBER 4 #define SCE_C_WORD 5 #define SCE_C_STRING 6 #define SCE_C_CHARACTER 7 #define SCE_C_UUID 8 #define SCE_C_PREPROCESSOR 9 #define SCE_C_OPERATOR 10 #define SCE_C_IDENTIFIER 11 #define SCE_C_STRINGEOL 12 #define SCE_C_VERBATIM 13 #define SCE_C_REGEX 14 #define SCE_C_COMMENTLINEDOC 15 #define SCE_C_WORD2 16 #define SCE_C_COMMENTDOCKEYWORD 17 #define SCE_C_COMMENTDOCKEYWORDERROR 18 #define SCE_C_GLOBALCLASS 19 #define SCE_D_DEFAULT 0 #define SCE_D_COMMENT 1 #define SCE_D_COMMENTLINE 2 #define SCE_D_COMMENTDOC 3 #define SCE_D_COMMENTNESTED 4 #define SCE_D_NUMBER 5 #define SCE_D_WORD 6 #define SCE_D_WORD2 7 #define SCE_D_WORD3 8 #define SCE_D_TYPEDEF 9 #define SCE_D_STRING 10 #define SCE_D_STRINGEOL 11 #define SCE_D_CHARACTER 12 #define SCE_D_OPERATOR 13 #define SCE_D_IDENTIFIER 14 #define SCE_D_COMMENTLINEDOC 15 #define SCE_D_COMMENTDOCKEYWORD 16 #define SCE_D_COMMENTDOCKEYWORDERROR 17 #define SCE_TCL_DEFAULT 0 #define SCE_TCL_COMMENT 1 #define SCE_TCL_COMMENTLINE 2 #define SCE_TCL_NUMBER 3 #define SCE_TCL_WORD_IN_QUOTE 4 #define SCE_TCL_IN_QUOTE 5 #define SCE_TCL_OPERATOR 6 #define SCE_TCL_IDENTIFIER 7 #define SCE_TCL_SUBSTITUTION 8 #define SCE_TCL_SUB_BRACE 9 #define SCE_TCL_MODIFIER 10 #define SCE_TCL_EXPAND 11 #define SCE_TCL_WORD 12 #define SCE_TCL_WORD2 13 #define SCE_TCL_WORD3 14 #define SCE_TCL_WORD4 15 #define SCE_TCL_WORD5 16 #define SCE_TCL_WORD6 17 #define SCE_TCL_WORD7 18 #define SCE_TCL_WORD8 19 #define SCE_TCL_COMMENT_BOX 20 #define SCE_TCL_BLOCK_COMMENT 21 #define SCE_H_DEFAULT 0 #define SCE_H_TAG 1 #define SCE_H_TAGUNKNOWN 2 #define SCE_H_ATTRIBUTE 3 #define SCE_H_ATTRIBUTEUNKNOWN 4 #define SCE_H_NUMBER 5 #define SCE_H_DOUBLESTRING 6 #define SCE_H_SINGLESTRING 7 #define SCE_H_OTHER 8 #define SCE_H_COMMENT 9 #define SCE_H_ENTITY 10 #define SCE_H_TAGEND 11 #define SCE_H_XMLSTART 12 #define SCE_H_XMLEND 13 #define SCE_H_SCRIPT 14 #define SCE_H_ASP 15 #define SCE_H_ASPAT 16 #define SCE_H_CDATA 17 #define SCE_H_QUESTION 18 #define SCE_H_VALUE 19 #define SCE_H_XCCOMMENT 20 #define SCE_H_SGML_DEFAULT 21 #define SCE_H_SGML_COMMAND 22 #define SCE_H_SGML_1ST_PARAM 23 #define SCE_H_SGML_DOUBLESTRING 24 #define SCE_H_SGML_SIMPLESTRING 25 #define SCE_H_SGML_ERROR 26 #define SCE_H_SGML_SPECIAL 27 #define SCE_H_SGML_ENTITY 28 #define SCE_H_SGML_COMMENT 29 #define SCE_H_SGML_1ST_PARAM_COMMENT 30 #define SCE_H_SGML_BLOCK_DEFAULT 31 #define SCE_HJ_START 40 #define SCE_HJ_DEFAULT 41 #define SCE_HJ_COMMENT 42 #define SCE_HJ_COMMENTLINE 43 #define SCE_HJ_COMMENTDOC 44 #define SCE_HJ_NUMBER 45 #define SCE_HJ_WORD 46 #define SCE_HJ_KEYWORD 47 #define SCE_HJ_DOUBLESTRING 48 #define SCE_HJ_SINGLESTRING 49 #define SCE_HJ_SYMBOLS 50 #define SCE_HJ_STRINGEOL 51 #define SCE_HJ_REGEX 52 #define SCE_HJA_START 55 #define SCE_HJA_DEFAULT 56 #define SCE_HJA_COMMENT 57 #define SCE_HJA_COMMENTLINE 58 #define SCE_HJA_COMMENTDOC 59 #define SCE_HJA_NUMBER 60 #define SCE_HJA_WORD 61 #define SCE_HJA_KEYWORD 62 #define SCE_HJA_DOUBLESTRING 63 #define SCE_HJA_SINGLESTRING 64 #define SCE_HJA_SYMBOLS 65 #define SCE_HJA_STRINGEOL 66 #define SCE_HJA_REGEX 67 #define SCE_HB_START 70 #define SCE_HB_DEFAULT 71 #define SCE_HB_COMMENTLINE 72 #define SCE_HB_NUMBER 73 #define SCE_HB_WORD 74 #define SCE_HB_STRING 75 #define SCE_HB_IDENTIFIER 76 #define SCE_HB_STRINGEOL 77 #define SCE_HBA_START 80 #define SCE_HBA_DEFAULT 81 #define SCE_HBA_COMMENTLINE 82 #define SCE_HBA_NUMBER 83 #define SCE_HBA_WORD 84 #define SCE_HBA_STRING 85 #define SCE_HBA_IDENTIFIER 86 #define SCE_HBA_STRINGEOL 87 #define SCE_HP_START 90 #define SCE_HP_DEFAULT 91 #define SCE_HP_COMMENTLINE 92 #define SCE_HP_NUMBER 93 #define SCE_HP_STRING 94 #define SCE_HP_CHARACTER 95 #define SCE_HP_WORD 96 #define SCE_HP_TRIPLE 97 #define SCE_HP_TRIPLEDOUBLE 98 #define SCE_HP_CLASSNAME 99 #define SCE_HP_DEFNAME 100 #define SCE_HP_OPERATOR 101 #define SCE_HP_IDENTIFIER 102 #define SCE_HPHP_COMPLEX_VARIABLE 104 #define SCE_HPA_START 105 #define SCE_HPA_DEFAULT 106 #define SCE_HPA_COMMENTLINE 107 #define SCE_HPA_NUMBER 108 #define SCE_HPA_STRING 109 #define SCE_HPA_CHARACTER 110 #define SCE_HPA_WORD 111 #define SCE_HPA_TRIPLE 112 #define SCE_HPA_TRIPLEDOUBLE 113 #define SCE_HPA_CLASSNAME 114 #define SCE_HPA_DEFNAME 115 #define SCE_HPA_OPERATOR 116 #define SCE_HPA_IDENTIFIER 117 #define SCE_HPHP_DEFAULT 118 #define SCE_HPHP_HSTRING 119 #define SCE_HPHP_SIMPLESTRING 120 #define SCE_HPHP_WORD 121 #define SCE_HPHP_NUMBER 122 #define SCE_HPHP_VARIABLE 123 #define SCE_HPHP_COMMENT 124 #define SCE_HPHP_COMMENTLINE 125 #define SCE_HPHP_HSTRING_VARIABLE 126 #define SCE_HPHP_OPERATOR 127 #define SCE_PL_DEFAULT 0 #define SCE_PL_ERROR 1 #define SCE_PL_COMMENTLINE 2 #define SCE_PL_POD 3 #define SCE_PL_NUMBER 4 #define SCE_PL_WORD 5 #define SCE_PL_STRING 6 #define SCE_PL_CHARACTER 7 #define SCE_PL_PUNCTUATION 8 #define SCE_PL_PREPROCESSOR 9 #define SCE_PL_OPERATOR 10 #define SCE_PL_IDENTIFIER 11 #define SCE_PL_SCALAR 12 #define SCE_PL_ARRAY 13 #define SCE_PL_HASH 14 #define SCE_PL_SYMBOLTABLE 15 #define SCE_PL_VARIABLE_INDEXER 16 #define SCE_PL_REGEX 17 #define SCE_PL_REGSUBST 18 #define SCE_PL_LONGQUOTE 19 #define SCE_PL_BACKTICKS 20 #define SCE_PL_DATASECTION 21 #define SCE_PL_HERE_DELIM 22 #define SCE_PL_HERE_Q 23 #define SCE_PL_HERE_QQ 24 #define SCE_PL_HERE_QX 25 #define SCE_PL_STRING_Q 26 #define SCE_PL_STRING_QQ 27 #define SCE_PL_STRING_QX 28 #define SCE_PL_STRING_QR 29 #define SCE_PL_STRING_QW 30 #define SCE_PL_POD_VERB 31 #define SCE_RB_DEFAULT 0 #define SCE_RB_ERROR 1 #define SCE_RB_COMMENTLINE 2 #define SCE_RB_POD 3 #define SCE_RB_NUMBER 4 #define SCE_RB_WORD 5 #define SCE_RB_STRING 6 #define SCE_RB_CHARACTER 7 #define SCE_RB_CLASSNAME 8 #define SCE_RB_DEFNAME 9 #define SCE_RB_OPERATOR 10 #define SCE_RB_IDENTIFIER 11 #define SCE_RB_REGEX 12 #define SCE_RB_GLOBAL 13 #define SCE_RB_SYMBOL 14 #define SCE_RB_MODULE_NAME 15 #define SCE_RB_INSTANCE_VAR 16 #define SCE_RB_CLASS_VAR 17 #define SCE_RB_BACKTICKS 18 #define SCE_RB_DATASECTION 19 #define SCE_RB_HERE_DELIM 20 #define SCE_RB_HERE_Q 21 #define SCE_RB_HERE_QQ 22 #define SCE_RB_HERE_QX 23 #define SCE_RB_STRING_Q 24 #define SCE_RB_STRING_QQ 25 #define SCE_RB_STRING_QX 26 #define SCE_RB_STRING_QR 27 #define SCE_RB_STRING_QW 28 #define SCE_RB_WORD_DEMOTED 29 #define SCE_RB_STDIN 30 #define SCE_RB_STDOUT 31 #define SCE_RB_STDERR 40 #define SCE_RB_UPPER_BOUND 41 #define SCE_B_DEFAULT 0 #define SCE_B_COMMENT 1 #define SCE_B_NUMBER 2 #define SCE_B_KEYWORD 3 #define SCE_B_STRING 4 #define SCE_B_PREPROCESSOR 5 #define SCE_B_OPERATOR 6 #define SCE_B_IDENTIFIER 7 #define SCE_B_DATE 8 #define SCE_B_STRINGEOL 9 #define SCE_B_KEYWORD2 10 #define SCE_B_KEYWORD3 11 #define SCE_B_KEYWORD4 12 #define SCE_B_CONSTANT 13 #define SCE_B_ASM 14 #define SCE_B_LABEL 15 #define SCE_B_ERROR 16 #define SCE_B_HEXNUMBER 17 #define SCE_B_BINNUMBER 18 #define SCE_PROPS_DEFAULT 0 #define SCE_PROPS_COMMENT 1 #define SCE_PROPS_SECTION 2 #define SCE_PROPS_ASSIGNMENT 3 #define SCE_PROPS_DEFVAL 4 #define SCE_PROPS_KEY 5 #define SCE_L_DEFAULT 0 #define SCE_L_COMMAND 1 #define SCE_L_TAG 2 #define SCE_L_MATH 3 #define SCE_L_COMMENT 4 #define SCE_LUA_DEFAULT 0 #define SCE_LUA_COMMENT 1 #define SCE_LUA_COMMENTLINE 2 #define SCE_LUA_COMMENTDOC 3 #define SCE_LUA_NUMBER 4 #define SCE_LUA_WORD 5 #define SCE_LUA_STRING 6 #define SCE_LUA_CHARACTER 7 #define SCE_LUA_LITERALSTRING 8 #define SCE_LUA_PREPROCESSOR 9 #define SCE_LUA_OPERATOR 10 #define SCE_LUA_IDENTIFIER 11 #define SCE_LUA_STRINGEOL 12 #define SCE_LUA_WORD2 13 #define SCE_LUA_WORD3 14 #define SCE_LUA_WORD4 15 #define SCE_LUA_WORD5 16 #define SCE_LUA_WORD6 17 #define SCE_LUA_WORD7 18 #define SCE_LUA_WORD8 19 #define SCE_ERR_DEFAULT 0 #define SCE_ERR_PYTHON 1 #define SCE_ERR_GCC 2 #define SCE_ERR_MS 3 #define SCE_ERR_CMD 4 #define SCE_ERR_BORLAND 5 #define SCE_ERR_PERL 6 #define SCE_ERR_NET 7 #define SCE_ERR_LUA 8 #define SCE_ERR_CTAG 9 #define SCE_ERR_DIFF_CHANGED 10 #define SCE_ERR_DIFF_ADDITION 11 #define SCE_ERR_DIFF_DELETION 12 #define SCE_ERR_DIFF_MESSAGE 13 #define SCE_ERR_PHP 14 #define SCE_ERR_ELF 15 #define SCE_ERR_IFC 16 #define SCE_ERR_IFORT 17 #define SCE_ERR_ABSF 18 #define SCE_ERR_TIDY 19 #define SCE_ERR_JAVA_STACK 20 #define SCE_BAT_DEFAULT 0 #define SCE_BAT_COMMENT 1 #define SCE_BAT_WORD 2 #define SCE_BAT_LABEL 3 #define SCE_BAT_HIDE 4 #define SCE_BAT_COMMAND 5 #define SCE_BAT_IDENTIFIER 6 #define SCE_BAT_OPERATOR 7 #define SCE_MAKE_DEFAULT 0 #define SCE_MAKE_COMMENT 1 #define SCE_MAKE_PREPROCESSOR 2 #define SCE_MAKE_IDENTIFIER 3 #define SCE_MAKE_OPERATOR 4 #define SCE_MAKE_TARGET 5 #define SCE_MAKE_IDEOL 9 #define SCE_DIFF_DEFAULT 0 #define SCE_DIFF_COMMENT 1 #define SCE_DIFF_COMMAND 2 #define SCE_DIFF_HEADER 3 #define SCE_DIFF_POSITION 4 #define SCE_DIFF_DELETED 5 #define SCE_DIFF_ADDED 6 #define SCE_CONF_DEFAULT 0 #define SCE_CONF_COMMENT 1 #define SCE_CONF_NUMBER 2 #define SCE_CONF_IDENTIFIER 3 #define SCE_CONF_EXTENSION 4 #define SCE_CONF_PARAMETER 5 #define SCE_CONF_STRING 6 #define SCE_CONF_OPERATOR 7 #define SCE_CONF_IP 8 #define SCE_CONF_DIRECTIVE 9 #define SCE_AVE_DEFAULT 0 #define SCE_AVE_COMMENT 1 #define SCE_AVE_NUMBER 2 #define SCE_AVE_WORD 3 #define SCE_AVE_STRING 6 #define SCE_AVE_ENUM 7 #define SCE_AVE_STRINGEOL 8 #define SCE_AVE_IDENTIFIER 9 #define SCE_AVE_OPERATOR 10 #define SCE_AVE_WORD1 11 #define SCE_AVE_WORD2 12 #define SCE_AVE_WORD3 13 #define SCE_AVE_WORD4 14 #define SCE_AVE_WORD5 15 #define SCE_AVE_WORD6 16 #define SCE_ADA_DEFAULT 0 #define SCE_ADA_WORD 1 #define SCE_ADA_IDENTIFIER 2 #define SCE_ADA_NUMBER 3 #define SCE_ADA_DELIMITER 4 #define SCE_ADA_CHARACTER 5 #define SCE_ADA_CHARACTEREOL 6 #define SCE_ADA_STRING 7 #define SCE_ADA_STRINGEOL 8 #define SCE_ADA_LABEL 9 #define SCE_ADA_COMMENTLINE 10 #define SCE_ADA_ILLEGAL 11 #define SCE_BAAN_DEFAULT 0 #define SCE_BAAN_COMMENT 1 #define SCE_BAAN_COMMENTDOC 2 #define SCE_BAAN_NUMBER 3 #define SCE_BAAN_WORD 4 #define SCE_BAAN_STRING 5 #define SCE_BAAN_PREPROCESSOR 6 #define SCE_BAAN_OPERATOR 7 #define SCE_BAAN_IDENTIFIER 8 #define SCE_BAAN_STRINGEOL 9 #define SCE_BAAN_WORD2 10 #define SCE_LISP_DEFAULT 0 #define SCE_LISP_COMMENT 1 #define SCE_LISP_NUMBER 2 #define SCE_LISP_KEYWORD 3 #define SCE_LISP_KEYWORD_KW 4 #define SCE_LISP_SYMBOL 5 #define SCE_LISP_STRING 6 #define SCE_LISP_STRINGEOL 8 #define SCE_LISP_IDENTIFIER 9 #define SCE_LISP_OPERATOR 10 #define SCE_LISP_SPECIAL 11 #define SCE_LISP_MULTI_COMMENT 12 #define SCE_EIFFEL_DEFAULT 0 #define SCE_EIFFEL_COMMENTLINE 1 #define SCE_EIFFEL_NUMBER 2 #define SCE_EIFFEL_WORD 3 #define SCE_EIFFEL_STRING 4 #define SCE_EIFFEL_CHARACTER 5 #define SCE_EIFFEL_OPERATOR 6 #define SCE_EIFFEL_IDENTIFIER 7 #define SCE_EIFFEL_STRINGEOL 8 #define SCE_NNCRONTAB_DEFAULT 0 #define SCE_NNCRONTAB_COMMENT 1 #define SCE_NNCRONTAB_TASK 2 #define SCE_NNCRONTAB_SECTION 3 #define SCE_NNCRONTAB_KEYWORD 4 #define SCE_NNCRONTAB_MODIFIER 5 #define SCE_NNCRONTAB_ASTERISK 6 #define SCE_NNCRONTAB_NUMBER 7 #define SCE_NNCRONTAB_STRING 8 #define SCE_NNCRONTAB_ENVIRONMENT 9 #define SCE_NNCRONTAB_IDENTIFIER 10 #define SCE_FORTH_DEFAULT 0 #define SCE_FORTH_COMMENT 1 #define SCE_FORTH_COMMENT_ML 2 #define SCE_FORTH_IDENTIFIER 3 #define SCE_FORTH_CONTROL 4 #define SCE_FORTH_KEYWORD 5 #define SCE_FORTH_DEFWORD 6 #define SCE_FORTH_PREWORD1 7 #define SCE_FORTH_PREWORD2 8 #define SCE_FORTH_NUMBER 9 #define SCE_FORTH_STRING 10 #define SCE_FORTH_LOCALE 11 #define SCE_MATLAB_DEFAULT 0 #define SCE_MATLAB_COMMENT 1 #define SCE_MATLAB_COMMAND 2 #define SCE_MATLAB_NUMBER 3 #define SCE_MATLAB_KEYWORD 4 #define SCE_MATLAB_STRING 5 #define SCE_MATLAB_OPERATOR 6 #define SCE_MATLAB_IDENTIFIER 7 #define SCE_MATLAB_DOUBLEQUOTESTRING 8 #define SCE_SCRIPTOL_DEFAULT 0 #define SCE_SCRIPTOL_WHITE 1 #define SCE_SCRIPTOL_COMMENTLINE 2 #define SCE_SCRIPTOL_PERSISTENT 3 #define SCE_SCRIPTOL_CSTYLE 4 #define SCE_SCRIPTOL_COMMENTBLOCK 5 #define SCE_SCRIPTOL_NUMBER 6 #define SCE_SCRIPTOL_STRING 7 #define SCE_SCRIPTOL_CHARACTER 8 #define SCE_SCRIPTOL_STRINGEOL 9 #define SCE_SCRIPTOL_KEYWORD 10 #define SCE_SCRIPTOL_OPERATOR 11 #define SCE_SCRIPTOL_IDENTIFIER 12 #define SCE_SCRIPTOL_TRIPLE 13 #define SCE_SCRIPTOL_CLASSNAME 14 #define SCE_SCRIPTOL_PREPROCESSOR 15 #define SCE_ASM_DEFAULT 0 #define SCE_ASM_COMMENT 1 #define SCE_ASM_NUMBER 2 #define SCE_ASM_STRING 3 #define SCE_ASM_OPERATOR 4 #define SCE_ASM_IDENTIFIER 5 #define SCE_ASM_CPUINSTRUCTION 6 #define SCE_ASM_MATHINSTRUCTION 7 #define SCE_ASM_REGISTER 8 #define SCE_ASM_DIRECTIVE 9 #define SCE_ASM_DIRECTIVEOPERAND 10 #define SCE_ASM_COMMENTBLOCK 11 #define SCE_ASM_CHARACTER 12 #define SCE_ASM_STRINGEOL 13 #define SCE_ASM_EXTINSTRUCTION 14 #define SCE_F_DEFAULT 0 #define SCE_F_COMMENT 1 #define SCE_F_NUMBER 2 #define SCE_F_STRING1 3 #define SCE_F_STRING2 4 #define SCE_F_STRINGEOL 5 #define SCE_F_OPERATOR 6 #define SCE_F_IDENTIFIER 7 #define SCE_F_WORD 8 #define SCE_F_WORD2 9 #define SCE_F_WORD3 10 #define SCE_F_PREPROCESSOR 11 #define SCE_F_OPERATOR2 12 #define SCE_F_LABEL 13 #define SCE_F_CONTINUATION 14 #define SCE_CSS_DEFAULT 0 #define SCE_CSS_TAG 1 #define SCE_CSS_CLASS 2 #define SCE_CSS_PSEUDOCLASS 3 #define SCE_CSS_UNKNOWN_PSEUDOCLASS 4 #define SCE_CSS_OPERATOR 5 #define SCE_CSS_IDENTIFIER 6 #define SCE_CSS_UNKNOWN_IDENTIFIER 7 #define SCE_CSS_VALUE 8 #define SCE_CSS_COMMENT 9 #define SCE_CSS_ID 10 #define SCE_CSS_IMPORTANT 11 #define SCE_CSS_DIRECTIVE 12 #define SCE_CSS_DOUBLESTRING 13 #define SCE_CSS_SINGLESTRING 14 #define SCE_CSS_IDENTIFIER2 15 #define SCE_CSS_ATTRIBUTE 16 #define SCE_POV_DEFAULT 0 #define SCE_POV_COMMENT 1 #define SCE_POV_COMMENTLINE 2 #define SCE_POV_NUMBER 3 #define SCE_POV_OPERATOR 4 #define SCE_POV_IDENTIFIER 5 #define SCE_POV_STRING 6 #define SCE_POV_STRINGEOL 7 #define SCE_POV_DIRECTIVE 8 #define SCE_POV_BADDIRECTIVE 9 #define SCE_POV_WORD2 10 #define SCE_POV_WORD3 11 #define SCE_POV_WORD4 12 #define SCE_POV_WORD5 13 #define SCE_POV_WORD6 14 #define SCE_POV_WORD7 15 #define SCE_POV_WORD8 16 #define SCE_LOUT_DEFAULT 0 #define SCE_LOUT_COMMENT 1 #define SCE_LOUT_NUMBER 2 #define SCE_LOUT_WORD 3 #define SCE_LOUT_WORD2 4 #define SCE_LOUT_WORD3 5 #define SCE_LOUT_WORD4 6 #define SCE_LOUT_STRING 7 #define SCE_LOUT_OPERATOR 8 #define SCE_LOUT_IDENTIFIER 9 #define SCE_LOUT_STRINGEOL 10 #define SCE_ESCRIPT_DEFAULT 0 #define SCE_ESCRIPT_COMMENT 1 #define SCE_ESCRIPT_COMMENTLINE 2 #define SCE_ESCRIPT_COMMENTDOC 3 #define SCE_ESCRIPT_NUMBER 4 #define SCE_ESCRIPT_WORD 5 #define SCE_ESCRIPT_STRING 6 #define SCE_ESCRIPT_OPERATOR 7 #define SCE_ESCRIPT_IDENTIFIER 8 #define SCE_ESCRIPT_BRACE 9 #define SCE_ESCRIPT_WORD2 10 #define SCE_ESCRIPT_WORD3 11 #define SCE_PS_DEFAULT 0 #define SCE_PS_COMMENT 1 #define SCE_PS_DSC_COMMENT 2 #define SCE_PS_DSC_VALUE 3 #define SCE_PS_NUMBER 4 #define SCE_PS_NAME 5 #define SCE_PS_KEYWORD 6 #define SCE_PS_LITERAL 7 #define SCE_PS_IMMEVAL 8 #define SCE_PS_PAREN_ARRAY 9 #define SCE_PS_PAREN_DICT 10 #define SCE_PS_PAREN_PROC 11 #define SCE_PS_TEXT 12 #define SCE_PS_HEXSTRING 13 #define SCE_PS_BASE85STRING 14 #define SCE_PS_BADSTRINGCHAR 15 #define SCE_NSIS_DEFAULT 0 #define SCE_NSIS_COMMENT 1 #define SCE_NSIS_STRINGDQ 2 #define SCE_NSIS_STRINGLQ 3 #define SCE_NSIS_STRINGRQ 4 #define SCE_NSIS_FUNCTION 5 #define SCE_NSIS_VARIABLE 6 #define SCE_NSIS_LABEL 7 #define SCE_NSIS_USERDEFINED 8 #define SCE_NSIS_SECTIONDEF 9 #define SCE_NSIS_SUBSECTIONDEF 10 #define SCE_NSIS_IFDEFINEDEF 11 #define SCE_NSIS_MACRODEF 12 #define SCE_NSIS_STRINGVAR 13 #define SCE_NSIS_NUMBER 14 #define SCE_NSIS_SECTIONGROUP 15 #define SCE_NSIS_PAGEEX 16 #define SCE_NSIS_FUNCTIONDEF 17 #define SCE_NSIS_COMMENTBOX 18 #define SCE_MMIXAL_LEADWS 0 #define SCE_MMIXAL_COMMENT 1 #define SCE_MMIXAL_LABEL 2 #define SCE_MMIXAL_OPCODE 3 #define SCE_MMIXAL_OPCODE_PRE 4 #define SCE_MMIXAL_OPCODE_VALID 5 #define SCE_MMIXAL_OPCODE_UNKNOWN 6 #define SCE_MMIXAL_OPCODE_POST 7 #define SCE_MMIXAL_OPERANDS 8 #define SCE_MMIXAL_NUMBER 9 #define SCE_MMIXAL_REF 10 #define SCE_MMIXAL_CHAR 11 #define SCE_MMIXAL_STRING 12 #define SCE_MMIXAL_REGISTER 13 #define SCE_MMIXAL_HEX 14 #define SCE_MMIXAL_OPERATOR 15 #define SCE_MMIXAL_SYMBOL 16 #define SCE_MMIXAL_INCLUDE 17 #define SCE_CLW_DEFAULT 0 #define SCE_CLW_LABEL 1 #define SCE_CLW_COMMENT 2 #define SCE_CLW_STRING 3 #define SCE_CLW_USER_IDENTIFIER 4 #define SCE_CLW_INTEGER_CONSTANT 5 #define SCE_CLW_REAL_CONSTANT 6 #define SCE_CLW_PICTURE_STRING 7 #define SCE_CLW_KEYWORD 8 #define SCE_CLW_COMPILER_DIRECTIVE 9 #define SCE_CLW_RUNTIME_EXPRESSIONS 10 #define SCE_CLW_BUILTIN_PROCEDURES_FUNCTION 11 #define SCE_CLW_STRUCTURE_DATA_TYPE 12 #define SCE_CLW_ATTRIBUTE 13 #define SCE_CLW_STANDARD_EQUATE 14 #define SCE_CLW_ERROR 15 #define SCE_CLW_DEPRECATED 16 #define SCE_LOT_DEFAULT 0 #define SCE_LOT_HEADER 1 #define SCE_LOT_BREAK 2 #define SCE_LOT_SET 3 #define SCE_LOT_PASS 4 #define SCE_LOT_FAIL 5 #define SCE_LOT_ABORT 6 #define SCE_YAML_DEFAULT 0 #define SCE_YAML_COMMENT 1 #define SCE_YAML_IDENTIFIER 2 #define SCE_YAML_KEYWORD 3 #define SCE_YAML_NUMBER 4 #define SCE_YAML_REFERENCE 5 #define SCE_YAML_DOCUMENT 6 #define SCE_YAML_TEXT 7 #define SCE_YAML_ERROR 8 #define SCE_TEX_DEFAULT 0 #define SCE_TEX_SPECIAL 1 #define SCE_TEX_GROUP 2 #define SCE_TEX_SYMBOL 3 #define SCE_TEX_COMMAND 4 #define SCE_TEX_TEXT 5 #define SCE_METAPOST_DEFAULT 0 #define SCE_METAPOST_SPECIAL 1 #define SCE_METAPOST_GROUP 2 #define SCE_METAPOST_SYMBOL 3 #define SCE_METAPOST_COMMAND 4 #define SCE_METAPOST_TEXT 5 #define SCE_METAPOST_EXTRA 6 #define SCE_ERLANG_DEFAULT 0 #define SCE_ERLANG_COMMENT 1 #define SCE_ERLANG_VARIABLE 2 #define SCE_ERLANG_NUMBER 3 #define SCE_ERLANG_KEYWORD 4 #define SCE_ERLANG_STRING 5 #define SCE_ERLANG_OPERATOR 6 #define SCE_ERLANG_ATOM 7 #define SCE_ERLANG_FUNCTION_NAME 8 #define SCE_ERLANG_CHARACTER 9 #define SCE_ERLANG_MACRO 10 #define SCE_ERLANG_RECORD 11 #define SCE_ERLANG_SEPARATOR 12 #define SCE_ERLANG_NODE_NAME 13 #define SCE_ERLANG_UNKNOWN 31 #define SCE_MSSQL_DEFAULT 0 #define SCE_MSSQL_COMMENT 1 #define SCE_MSSQL_LINE_COMMENT 2 #define SCE_MSSQL_NUMBER 3 #define SCE_MSSQL_STRING 4 #define SCE_MSSQL_OPERATOR 5 #define SCE_MSSQL_IDENTIFIER 6 #define SCE_MSSQL_VARIABLE 7 #define SCE_MSSQL_COLUMN_NAME 8 #define SCE_MSSQL_STATEMENT 9 #define SCE_MSSQL_DATATYPE 10 #define SCE_MSSQL_SYSTABLE 11 #define SCE_MSSQL_GLOBAL_VARIABLE 12 #define SCE_MSSQL_FUNCTION 13 #define SCE_MSSQL_STORED_PROCEDURE 14 #define SCE_MSSQL_DEFAULT_PREF_DATATYPE 15 #define SCE_MSSQL_COLUMN_NAME_2 16 #define SCE_V_DEFAULT 0 #define SCE_V_COMMENT 1 #define SCE_V_COMMENTLINE 2 #define SCE_V_COMMENTLINEBANG 3 #define SCE_V_NUMBER 4 #define SCE_V_WORD 5 #define SCE_V_STRING 6 #define SCE_V_WORD2 7 #define SCE_V_WORD3 8 #define SCE_V_PREPROCESSOR 9 #define SCE_V_OPERATOR 10 #define SCE_V_IDENTIFIER 11 #define SCE_V_STRINGEOL 12 #define SCE_V_USER 19 #define SCE_KIX_DEFAULT 0 #define SCE_KIX_COMMENT 1 #define SCE_KIX_STRING1 2 #define SCE_KIX_STRING2 3 #define SCE_KIX_NUMBER 4 #define SCE_KIX_VAR 5 #define SCE_KIX_MACRO 6 #define SCE_KIX_KEYWORD 7 #define SCE_KIX_FUNCTIONS 8 #define SCE_KIX_OPERATOR 9 #define SCE_KIX_IDENTIFIER 31 #define SCE_GC_DEFAULT 0 #define SCE_GC_COMMENTLINE 1 #define SCE_GC_COMMENTBLOCK 2 #define SCE_GC_GLOBAL 3 #define SCE_GC_EVENT 4 #define SCE_GC_ATTRIBUTE 5 #define SCE_GC_CONTROL 6 #define SCE_GC_COMMAND 7 #define SCE_GC_STRING 8 #define SCE_GC_OPERATOR 9 #define SCE_SN_DEFAULT 0 #define SCE_SN_CODE 1 #define SCE_SN_COMMENTLINE 2 #define SCE_SN_COMMENTLINEBANG 3 #define SCE_SN_NUMBER 4 #define SCE_SN_WORD 5 #define SCE_SN_STRING 6 #define SCE_SN_WORD2 7 #define SCE_SN_WORD3 8 #define SCE_SN_PREPROCESSOR 9 #define SCE_SN_OPERATOR 10 #define SCE_SN_IDENTIFIER 11 #define SCE_SN_STRINGEOL 12 #define SCE_SN_REGEXTAG 13 #define SCE_SN_SIGNAL 14 #define SCE_SN_USER 19 #define SCE_AU3_DEFAULT 0 #define SCE_AU3_COMMENT 1 #define SCE_AU3_COMMENTBLOCK 2 #define SCE_AU3_NUMBER 3 #define SCE_AU3_FUNCTION 4 #define SCE_AU3_KEYWORD 5 #define SCE_AU3_MACRO 6 #define SCE_AU3_STRING 7 #define SCE_AU3_OPERATOR 8 #define SCE_AU3_VARIABLE 9 #define SCE_AU3_SENT 10 #define SCE_AU3_PREPROCESSOR 11 #define SCE_AU3_SPECIAL 12 #define SCE_AU3_EXPAND 13 #define SCE_AU3_COMOBJ 14 #define SCE_AU3_UDF 15 #define SCE_APDL_DEFAULT 0 #define SCE_APDL_COMMENT 1 #define SCE_APDL_COMMENTBLOCK 2 #define SCE_APDL_NUMBER 3 #define SCE_APDL_STRING 4 #define SCE_APDL_OPERATOR 5 #define SCE_APDL_WORD 6 #define SCE_APDL_PROCESSOR 7 #define SCE_APDL_COMMAND 8 #define SCE_APDL_SLASHCOMMAND 9 #define SCE_APDL_STARCOMMAND 10 #define SCE_APDL_ARGUMENT 11 #define SCE_APDL_FUNCTION 12 #define SCE_SH_DEFAULT 0 #define SCE_SH_ERROR 1 #define SCE_SH_COMMENTLINE 2 #define SCE_SH_NUMBER 3 #define SCE_SH_WORD 4 #define SCE_SH_STRING 5 #define SCE_SH_CHARACTER 6 #define SCE_SH_OPERATOR 7 #define SCE_SH_IDENTIFIER 8 #define SCE_SH_SCALAR 9 #define SCE_SH_PARAM 10 #define SCE_SH_BACKTICKS 11 #define SCE_SH_HERE_DELIM 12 #define SCE_SH_HERE_Q 13 #define SCE_ASN1_DEFAULT 0 #define SCE_ASN1_COMMENT 1 #define SCE_ASN1_IDENTIFIER 2 #define SCE_ASN1_STRING 3 #define SCE_ASN1_OID 4 #define SCE_ASN1_SCALAR 5 #define SCE_ASN1_KEYWORD 6 #define SCE_ASN1_ATTRIBUTE 7 #define SCE_ASN1_DESCRIPTOR 8 #define SCE_ASN1_TYPE 9 #define SCE_ASN1_OPERATOR 10 #define SCE_VHDL_DEFAULT 0 #define SCE_VHDL_COMMENT 1 #define SCE_VHDL_COMMENTLINEBANG 2 #define SCE_VHDL_NUMBER 3 #define SCE_VHDL_STRING 4 #define SCE_VHDL_OPERATOR 5 #define SCE_VHDL_IDENTIFIER 6 #define SCE_VHDL_STRINGEOL 7 #define SCE_VHDL_KEYWORD 8 #define SCE_VHDL_STDOPERATOR 9 #define SCE_VHDL_ATTRIBUTE 10 #define SCE_VHDL_STDFUNCTION 11 #define SCE_VHDL_STDPACKAGE 12 #define SCE_VHDL_STDTYPE 13 #define SCE_VHDL_USERWORD 14 #define SCE_CAML_DEFAULT 0 #define SCE_CAML_IDENTIFIER 1 #define SCE_CAML_TAGNAME 2 #define SCE_CAML_KEYWORD 3 #define SCE_CAML_KEYWORD2 4 #define SCE_CAML_KEYWORD3 5 #define SCE_CAML_LINENUM 6 #define SCE_CAML_OPERATOR 7 #define SCE_CAML_NUMBER 8 #define SCE_CAML_CHAR 9 #define SCE_CAML_STRING 11 #define SCE_CAML_COMMENT 12 #define SCE_CAML_COMMENT1 13 #define SCE_CAML_COMMENT2 14 #define SCE_CAML_COMMENT3 15 #define SCE_HA_DEFAULT 0 #define SCE_HA_IDENTIFIER 1 #define SCE_HA_KEYWORD 2 #define SCE_HA_NUMBER 3 #define SCE_HA_STRING 4 #define SCE_HA_CHARACTER 5 #define SCE_HA_CLASS 6 #define SCE_HA_MODULE 7 #define SCE_HA_CAPITAL 8 #define SCE_HA_DATA 9 #define SCE_HA_IMPORT 10 #define SCE_HA_OPERATOR 11 #define SCE_HA_INSTANCE 12 #define SCE_HA_COMMENTLINE 13 #define SCE_HA_COMMENTBLOCK 14 #define SCE_HA_COMMENTBLOCK2 15 #define SCE_HA_COMMENTBLOCK3 16 #define SCE_T3_DEFAULT 0 #define SCE_T3_X_DEFAULT 1 #define SCE_T3_PREPROCESSOR 2 #define SCE_T3_BLOCK_COMMENT 3 #define SCE_T3_LINE_COMMENT 4 #define SCE_T3_OPERATOR 5 #define SCE_T3_KEYWORD 6 #define SCE_T3_NUMBER 7 #define SCE_T3_IDENTIFIER 8 #define SCE_T3_S_STRING 9 #define SCE_T3_D_STRING 10 #define SCE_T3_X_STRING 11 #define SCE_T3_LIB_DIRECTIVE 12 #define SCE_T3_MSG_PARAM 13 #define SCE_T3_HTML_TAG 14 #define SCE_T3_HTML_DEFAULT 15 #define SCE_T3_HTML_STRING 16 #define SCE_T3_USER1 17 #define SCE_T3_USER2 18 #define SCE_T3_USER3 19 #define SCE_T3_BRACE 20 #define SCE_REBOL_DEFAULT 0 #define SCE_REBOL_COMMENTLINE 1 #define SCE_REBOL_COMMENTBLOCK 2 #define SCE_REBOL_PREFACE 3 #define SCE_REBOL_OPERATOR 4 #define SCE_REBOL_CHARACTER 5 #define SCE_REBOL_QUOTEDSTRING 6 #define SCE_REBOL_BRACEDSTRING 7 #define SCE_REBOL_NUMBER 8 #define SCE_REBOL_PAIR 9 #define SCE_REBOL_TUPLE 10 #define SCE_REBOL_BINARY 11 #define SCE_REBOL_MONEY 12 #define SCE_REBOL_ISSUE 13 #define SCE_REBOL_TAG 14 #define SCE_REBOL_FILE 15 #define SCE_REBOL_EMAIL 16 #define SCE_REBOL_URL 17 #define SCE_REBOL_DATE 18 #define SCE_REBOL_TIME 19 #define SCE_REBOL_IDENTIFIER 20 #define SCE_REBOL_WORD 21 #define SCE_REBOL_WORD2 22 #define SCE_REBOL_WORD3 23 #define SCE_REBOL_WORD4 24 #define SCE_REBOL_WORD5 25 #define SCE_REBOL_WORD6 26 #define SCE_REBOL_WORD7 27 #define SCE_REBOL_WORD8 28 #define SCE_SQL_DEFAULT 0 #define SCE_SQL_COMMENT 1 #define SCE_SQL_COMMENTLINE 2 #define SCE_SQL_COMMENTDOC 3 #define SCE_SQL_NUMBER 4 #define SCE_SQL_WORD 5 #define SCE_SQL_STRING 6 #define SCE_SQL_CHARACTER 7 #define SCE_SQL_SQLPLUS 8 #define SCE_SQL_SQLPLUS_PROMPT 9 #define SCE_SQL_OPERATOR 10 #define SCE_SQL_IDENTIFIER 11 #define SCE_SQL_SQLPLUS_COMMENT 13 #define SCE_SQL_COMMENTLINEDOC 15 #define SCE_SQL_WORD2 16 #define SCE_SQL_COMMENTDOCKEYWORD 17 #define SCE_SQL_COMMENTDOCKEYWORDERROR 18 #define SCE_SQL_USER1 19 #define SCE_SQL_USER2 20 #define SCE_SQL_USER3 21 #define SCE_SQL_USER4 22 #define SCE_SQL_QUOTEDIDENTIFIER 23 #define SCE_ST_DEFAULT 0 #define SCE_ST_STRING 1 #define SCE_ST_NUMBER 2 #define SCE_ST_COMMENT 3 #define SCE_ST_SYMBOL 4 #define SCE_ST_BINARY 5 #define SCE_ST_BOOL 6 #define SCE_ST_SELF 7 #define SCE_ST_SUPER 8 #define SCE_ST_NIL 9 #define SCE_ST_GLOBAL 10 #define SCE_ST_RETURN 11 #define SCE_ST_SPECIAL 12 #define SCE_ST_KWSEND 13 #define SCE_ST_ASSIGN 14 #define SCE_ST_CHARACTER 15 #define SCE_ST_SPEC_SEL 16 #define SCE_FS_DEFAULT 0 #define SCE_FS_COMMENT 1 #define SCE_FS_COMMENTLINE 2 #define SCE_FS_COMMENTDOC 3 #define SCE_FS_COMMENTLINEDOC 4 #define SCE_FS_COMMENTDOCKEYWORD 5 #define SCE_FS_COMMENTDOCKEYWORDERROR 6 #define SCE_FS_KEYWORD 7 #define SCE_FS_KEYWORD2 8 #define SCE_FS_KEYWORD3 9 #define SCE_FS_KEYWORD4 10 #define SCE_FS_NUMBER 11 #define SCE_FS_STRING 12 #define SCE_FS_PREPROCESSOR 13 #define SCE_FS_OPERATOR 14 #define SCE_FS_IDENTIFIER 15 #define SCE_FS_DATE 16 #define SCE_FS_STRINGEOL 17 #define SCE_FS_CONSTANT 18 #define SCE_FS_ASM 19 #define SCE_FS_LABEL 20 #define SCE_FS_ERROR 21 #define SCE_FS_HEXNUMBER 22 #define SCE_FS_BINNUMBER 23 #define SCE_CSOUND_DEFAULT 0 #define SCE_CSOUND_COMMENT 1 #define SCE_CSOUND_NUMBER 2 #define SCE_CSOUND_OPERATOR 3 #define SCE_CSOUND_INSTR 4 #define SCE_CSOUND_IDENTIFIER 5 #define SCE_CSOUND_OPCODE 6 #define SCE_CSOUND_HEADERSTMT 7 #define SCE_CSOUND_USERKEYWORD 8 #define SCE_CSOUND_COMMENTBLOCK 9 #define SCE_CSOUND_PARAM 10 #define SCE_CSOUND_ARATE_VAR 11 #define SCE_CSOUND_KRATE_VAR 12 #define SCE_CSOUND_IRATE_VAR 13 #define SCE_CSOUND_GLOBAL_VAR 14 #define SCE_CSOUND_STRINGEOL 15 #define SCE_INNO_DEFAULT 0 #define SCE_INNO_COMMENT 1 #define SCE_INNO_KEYWORD 2 #define SCE_INNO_PARAMETER 3 #define SCE_INNO_SECTION 4 #define SCE_INNO_PREPROC 5 #define SCE_INNO_PREPROC_INLINE 6 #define SCE_INNO_COMMENT_PASCAL 7 #define SCE_INNO_KEYWORD_PASCAL 8 #define SCE_INNO_KEYWORD_USER 9 #define SCE_INNO_STRING_DOUBLE 10 #define SCE_INNO_STRING_SINGLE 11 #define SCE_INNO_IDENTIFIER 12 #define SCE_OPAL_SPACE 0 #define SCE_OPAL_COMMENT_BLOCK 1 #define SCE_OPAL_COMMENT_LINE 2 #define SCE_OPAL_INTEGER 3 #define SCE_OPAL_KEYWORD 4 #define SCE_OPAL_SORT 5 #define SCE_OPAL_STRING 6 #define SCE_OPAL_PAR 7 #define SCE_OPAL_BOOL_CONST 8 #define SCE_OPAL_DEFAULT 32 #define SCE_SPICE_DEFAULT 0 #define SCE_SPICE_IDENTIFIER 1 #define SCE_SPICE_KEYWORD 2 #define SCE_SPICE_KEYWORD2 3 #define SCE_SPICE_KEYWORD3 4 #define SCE_SPICE_NUMBER 5 #define SCE_SPICE_DELIMITER 6 #define SCE_SPICE_VALUE 7 #define SCE_SPICE_COMMENTLINE 8 #define SCE_CMAKE_DEFAULT 0 #define SCE_CMAKE_COMMENT 1 #define SCE_CMAKE_STRINGDQ 2 #define SCE_CMAKE_STRINGLQ 3 #define SCE_CMAKE_STRINGRQ 4 #define SCE_CMAKE_COMMANDS 5 #define SCE_CMAKE_PARAMETERS 6 #define SCE_CMAKE_VARIABLE 7 #define SCE_CMAKE_USERDEFINED 8 #define SCE_CMAKE_WHILEDEF 9 #define SCE_CMAKE_FOREACHDEF 10 #define SCE_CMAKE_IFDEFINEDEF 11 #define SCE_CMAKE_MACRODEF 12 #define SCE_CMAKE_STRINGVAR 13 #define SCE_CMAKE_NUMBER 14 #define SCE_GAP_DEFAULT 0 #define SCE_GAP_IDENTIFIER 1 #define SCE_GAP_KEYWORD 2 #define SCE_GAP_KEYWORD2 3 #define SCE_GAP_KEYWORD3 4 #define SCE_GAP_KEYWORD4 5 #define SCE_GAP_STRING 6 #define SCE_GAP_CHAR 7 #define SCE_GAP_OPERATOR 8 #define SCE_GAP_COMMENT 9 #define SCE_GAP_NUMBER 10 #define SCE_GAP_STRINGEOL 11 #define SCE_PLM_DEFAULT 0 #define SCE_PLM_COMMENT 1 #define SCE_PLM_STRING 2 #define SCE_PLM_NUMBER 3 #define SCE_PLM_IDENTIFIER 4 #define SCE_PLM_OPERATOR 5 #define SCE_PLM_CONTROL 6 #define SCE_PLM_KEYWORD 7 #define SCE_4GL_DEFAULT 0 #define SCE_4GL_NUMBER 1 #define SCE_4GL_WORD 2 #define SCE_4GL_STRING 3 #define SCE_4GL_CHARACTER 4 #define SCE_4GL_PREPROCESSOR 5 #define SCE_4GL_OPERATOR 6 #define SCE_4GL_IDENTIFIER 7 #define SCE_4GL_BLOCK 8 #define SCE_4GL_END 9 #define SCE_4GL_COMMENT1 10 #define SCE_4GL_COMMENT2 11 #define SCE_4GL_COMMENT3 12 #define SCE_4GL_COMMENT4 13 #define SCE_4GL_COMMENT5 14 #define SCE_4GL_COMMENT6 15 #define SCE_4GL_DEFAULT_ 16 #define SCE_4GL_NUMBER_ 17 #define SCE_4GL_WORD_ 18 #define SCE_4GL_STRING_ 19 #define SCE_4GL_CHARACTER_ 20 #define SCE_4GL_PREPROCESSOR_ 21 #define SCE_4GL_OPERATOR_ 22 #define SCE_4GL_IDENTIFIER_ 23 #define SCE_4GL_BLOCK_ 24 #define SCE_4GL_END_ 25 #define SCE_4GL_COMMENT1_ 26 #define SCE_4GL_COMMENT2_ 27 #define SCE_4GL_COMMENT3_ 28 #define SCE_4GL_COMMENT4_ 29 #define SCE_4GL_COMMENT5_ 30 #define SCE_4GL_COMMENT6_ 31 #define SCLEX_ASP 29 #define SCLEX_PHP 30 //--Autogenerated -- end of section automatically generated from Scintilla.iface #endif sqliteman-1.2.2/sqliteman/qscintilla2/include/Platform.h0000644000175000001440000003600211407213302022715 0ustar subzerousers// Scintilla source code edit control /** @file Platform.h ** Interface to platform facilities. Also includes some basic utilities. ** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef PLATFORM_H #define PLATFORM_H // PLAT_QT is Qt on any supported platform // PLAT_GTK = GTK+ on Linux or Win32 // PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32 // PLAT_WIN = Win32 API on Win32 OS // PLAT_WX is wxWindows on any supported platform #define PLAT_QT 0 #define PLAT_GTK 0 #define PLAT_GTK_WIN32 0 #define PLAT_MACOSX 0 #define PLAT_WIN 0 #define PLAT_WX 0 #define PLAT_FOX 0 #if defined(FOX) #undef PLAT_FOX #define PLAT_FOX 1 #elif defined(QT) #undef PLAT_QT #define PLAT_QT 1 // This is needed to work around an HP-UX bug with Qt4. #include #elif defined(__WX__) #undef PLAT_WX #define PLAT_WX 1 #elif defined(GTK) #undef PLAT_GTK #define PLAT_GTK 1 #ifdef _MSC_VER #undef PLAT_GTK_WIN32 #define PLAT_GTK_WIN32 1 #endif #elif defined(MACOSX) #undef PLAT_MACOSX #define PLAT_MACOSX 1 #else #undef PLAT_WIN #define PLAT_WIN 1 #endif #ifdef SCI_NAMESPACE namespace Scintilla { #endif // Underlying the implementation of the platform classes are platform specific types. // Sometimes these need to be passed around by client code so they are defined here typedef void *FontID; typedef void *SurfaceID; typedef void *WindowID; typedef void *MenuID; typedef void *TickerID; typedef void *Function; typedef void *IdlerID; /** * A geometric point class. * Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably. */ class Point { public: int x; int y; explicit Point(int x_=0, int y_=0) : x(x_), y(y_) { } // Other automatically defined methods (assignment, copy constructor, destructor) are fine static Point FromLong(long lpoint); }; /** * A geometric rectangle class. * PRectangle is exactly the same as the Win32 RECT so can be used interchangeably. * PRectangles contain their top and left sides, but not their right and bottom sides. */ class PRectangle { public: int left; int top; int right; int bottom; PRectangle(int left_=0, int top_=0, int right_=0, int bottom_ = 0) : left(left_), top(top_), right(right_), bottom(bottom_) { } // Other automatically defined methods (assignment, copy constructor, destructor) are fine bool operator==(PRectangle &rc) { return (rc.left == left) && (rc.right == right) && (rc.top == top) && (rc.bottom == bottom); } bool Contains(Point pt) { return (pt.x >= left) && (pt.x <= right) && (pt.y >= top) && (pt.y <= bottom); } bool Contains(PRectangle rc) { return (rc.left >= left) && (rc.right <= right) && (rc.top >= top) && (rc.bottom <= bottom); } bool Intersects(PRectangle other) { return (right > other.left) && (left < other.right) && (bottom > other.top) && (top < other.bottom); } void Move(int xDelta, int yDelta) { left += xDelta; top += yDelta; right += xDelta; bottom += yDelta; } int Width() { return right - left; } int Height() { return bottom - top; } }; /** * In some circumstances, including Win32 in paletted mode and GTK+, each colour * must be allocated before use. The desired colours are held in the ColourDesired class, * and after allocation the allocation entry is stored in the ColourAllocated class. In other * circumstances, such as Win32 in true colour mode, the allocation process just copies * the RGB values from the desired to the allocated class. * As each desired colour requires allocation before it can be used, the ColourPair class * holds both a ColourDesired and a ColourAllocated * The Palette class is responsible for managing the palette of colours which contains a * list of ColourPair objects and performs the allocation. */ /** * Holds a desired RGB colour. */ class ColourDesired { long co; public: ColourDesired(long lcol=0) { co = lcol; } ColourDesired(unsigned int red, unsigned int green, unsigned int blue) { Set(red, green, blue); } bool operator==(const ColourDesired &other) const { return co == other.co; } void Set(long lcol) { co = lcol; } void Set(unsigned int red, unsigned int green, unsigned int blue) { co = red | (green << 8) | (blue << 16); } static inline unsigned int ValueOfHex(const char ch) { if (ch >= '0' && ch <= '9') return ch - '0'; else if (ch >= 'A' && ch <= 'F') return ch - 'A' + 10; else if (ch >= 'a' && ch <= 'f') return ch - 'a' + 10; else return 0; } void Set(const char *val) { if (*val == '#') { val++; } unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]); unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]); unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]); Set(r, g, b); } long AsLong() const { return co; } unsigned int GetRed() { return co & 0xff; } unsigned int GetGreen() { return (co >> 8) & 0xff; } unsigned int GetBlue() { return (co >> 16) & 0xff; } }; /** * Holds an allocated RGB colour which may be an approximation to the desired colour. */ class ColourAllocated { long coAllocated; public: ColourAllocated(long lcol=0) { coAllocated = lcol; } void Set(long lcol) { coAllocated = lcol; } long AsLong() const { return coAllocated; } }; /** * Colour pairs hold a desired colour and an allocated colour. */ struct ColourPair { ColourDesired desired; ColourAllocated allocated; ColourPair(ColourDesired desired_=ColourDesired(0,0,0)) { desired = desired_; allocated.Set(desired.AsLong()); } void Copy() { allocated.Set(desired.AsLong()); } }; class Window; // Forward declaration for Palette /** * Colour palette management. */ class Palette { int used; int size; ColourPair *entries; #if PLAT_GTK void *allocatedPalette; // GdkColor * int allocatedLen; #endif // Private so Palette objects can not be copied Palette(const Palette &) {} Palette &operator=(const Palette &) { return *this; } public: #if PLAT_WIN void *hpal; #endif bool allowRealization; Palette(); ~Palette(); void Release(); /** * This method either adds a colour to the list of wanted colours (want==true) * or retrieves the allocated colour back to the ColourPair. * This is one method to make it easier to keep the code for wanting and retrieving in sync. */ void WantFind(ColourPair &cp, bool want); void Allocate(Window &w); }; /** * Font management. */ class Font { protected: FontID id; #if PLAT_WX int ascent; #endif // Private so Font objects can not be copied Font(const Font &) {} Font &operator=(const Font &) { id=0; return *this; } public: Font(); virtual ~Font(); virtual void Create(const char *faceName, int characterSet, int size, bool bold, bool italic, bool extraFontFlag=false); virtual void Release(); FontID GetID() { return id; } // Alias another font - caller guarantees not to Release void SetID(FontID id_) { id = id_; } friend class Surface; friend class SurfaceImpl; }; /** * A surface abstracts a place to draw. */ #if defined(PLAT_QT) class XPM; class QPainter; #endif class Surface { private: // Private so Surface objects can not be copied Surface(const Surface &) {} Surface &operator=(const Surface &) { return *this; } public: Surface() {}; virtual ~Surface() {}; static Surface *Allocate(); virtual void Init(WindowID wid)=0; virtual void Init(SurfaceID sid, WindowID wid)=0; virtual void InitPixMap(int width, int height, Surface *surface_, WindowID wid)=0; virtual void Release()=0; virtual bool Initialised()=0; virtual void PenColour(ColourAllocated fore)=0; virtual int LogPixelsY()=0; virtual int DeviceHeightFont(int points)=0; virtual void MoveTo(int x_, int y_)=0; virtual void LineTo(int x_, int y_)=0; virtual void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back)=0; virtual void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0; virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0; virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, ColourAllocated outline, int alphaOutline, int flags)=0; virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; virtual void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; virtual void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; virtual void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore)=0; virtual void MeasureWidths(Font &font_, const char *s, int len, int *positions)=0; virtual int WidthText(Font &font_, const char *s, int len)=0; virtual int WidthChar(Font &font_, char ch)=0; virtual int Ascent(Font &font_)=0; virtual int Descent(Font &font_)=0; virtual int InternalLeading(Font &font_)=0; virtual int ExternalLeading(Font &font_)=0; virtual int Height(Font &font_)=0; virtual int AverageCharWidth(Font &font_)=0; virtual int SetPalette(Palette *pal, bool inBackGround)=0; virtual void SetClip(PRectangle rc)=0; virtual void FlushCachedState()=0; virtual void SetUnicodeMode(bool unicodeMode_)=0; virtual void SetDBCSMode(int codePage)=0; #if defined(PLAT_QT) virtual void Init(QPainter *p)=0; virtual void DrawXPM(PRectangle rc, const XPM *xpm)=0; #endif }; /** * A simple callback action passing one piece of untyped user data. */ typedef void (*CallBackAction)(void*); /** * Class to hide the details of window manipulation. * Does not own the window which will normally have a longer life than this object. */ class Window { protected: WindowID id; #ifdef PLAT_MACOSX void *windowRef; void *control; #endif public: Window() : id(0), cursorLast(cursorInvalid) { #ifdef PLAT_MACOSX windowRef = 0; control = 0; #endif } Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) { #ifdef PLAT_MACOSX windowRef = 0; control = 0; #endif } virtual ~Window(); Window &operator=(WindowID id_) { id = id_; return *this; } WindowID GetID() const { return id; } bool Created() const { return id != 0; } void Destroy(); bool HasFocus(); PRectangle GetPosition(); void SetPosition(PRectangle rc); void SetPositionRelative(PRectangle rc, Window relativeTo); PRectangle GetClientPosition(); void Show(bool show=true); void InvalidateAll(); void InvalidateRectangle(PRectangle rc); virtual void SetFont(Font &font); enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand }; void SetCursor(Cursor curs); void SetTitle(const char *s); #ifdef PLAT_MACOSX void SetWindow(void *ref) { windowRef = ref; }; void SetControl(void *_control) { control = _control; }; #endif private: Cursor cursorLast; }; /** * Listbox management. */ class ListBox : public Window { public: ListBox(); virtual ~ListBox(); static ListBox *Allocate(); virtual void SetFont(Font &font)=0; virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_)=0; virtual void SetAverageCharWidth(int width)=0; virtual void SetVisibleRows(int rows)=0; virtual int GetVisibleRows() const=0; virtual PRectangle GetDesiredRect()=0; virtual int CaretFromEdge()=0; virtual void Clear()=0; virtual void Append(char *s, int type = -1)=0; virtual int Length()=0; virtual void Select(int n)=0; virtual int GetSelection()=0; virtual int Find(const char *prefix)=0; virtual void GetValue(int n, char *value, int len)=0; virtual void RegisterImage(int type, const char *xpm_data)=0; virtual void ClearRegisteredImages()=0; virtual void SetDoubleClickAction(CallBackAction, void *)=0; virtual void SetList(const char* list, char separator, char typesep)=0; }; /** * Menu management. */ class Menu { MenuID id; public: Menu(); MenuID GetID() { return id; } void CreatePopUp(); void Destroy(); void Show(Point pt, Window &w); }; class ElapsedTime { long bigBit; long littleBit; public: ElapsedTime(); double Duration(bool reset=false); }; /** * Dynamic Library (DLL/SO/...) loading */ class DynamicLibrary { public: virtual ~DynamicLibrary() {}; /// @return Pointer to function "name", or NULL on failure. virtual Function FindFunction(const char *name) = 0; /// @return true if the library was loaded successfully. virtual bool IsValid() = 0; /// @return An instance of a DynamicLibrary subclass with "modulePath" loaded. static DynamicLibrary *Load(const char *modulePath); }; /** * Platform class used to retrieve system wide parameters such as double click speed * and chrome colour. Not a creatable object, more of a module with several functions. */ class Platform { // Private so Platform objects can not be copied Platform(const Platform &) {} Platform &operator=(const Platform &) { return *this; } public: // Should be private because no new Platforms are ever created // but gcc warns about this Platform() {} ~Platform() {} static ColourDesired Chrome(); static ColourDesired ChromeHighlight(); static const char *DefaultFont(); static int DefaultFontSize(); static unsigned int DoubleClickTime(); static bool MouseButtonBounce(); #ifdef __APPLE__ static bool WaitMouseMoved(Point pt); #endif static void DebugDisplay(const char *s); static bool IsKeyDown(int key); static long SendScintilla( WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0); static long SendScintillaPointer( WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0); static bool IsDBCSLeadByte(int codePage, char ch); static int DBCSCharLength(int codePage, const char *s); static int DBCSCharMaxLength(); // These are utility functions not really tied to a platform static int Minimum(int a, int b); static int Maximum(int a, int b); // Next three assume 16 bit shorts and 32 bit longs static long LongFromTwoShorts(short a,short b) { return (a) | ((b) << 16); } static short HighShortFromLong(long x) { return static_cast(x >> 16); } static short LowShortFromLong(long x) { return static_cast(x & 0xffff); } static void DebugPrintf(const char *format, ...); static bool ShowAssertionPopUps(bool assertionPopUps_); static void Assert(const char *c, const char *file, int line); static int Clamp(int val, int minVal, int maxVal); }; #ifdef NDEBUG #define PLATFORM_ASSERT(c) ((void)0) #else #ifdef SCI_NAMESPACE #define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__)) #else #define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__)) #endif #endif #ifdef SCI_NAMESPACE } #endif // Shut up annoying Visual C++ warnings: #ifdef _MSC_VER #pragma warning(disable: 4244 4309 4514 4710) #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/include/ScintillaWidget.h0000644000175000001440000000277211407213302024226 0ustar subzerousers// Scintilla source code edit control /** @file ScintillaWidget.h ** Definition of Scintilla widget for GTK+. ** Only needed by GTK+ code but is harmless on other platforms. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef SCINTILLAWIDGET_H #define SCINTILLAWIDGET_H #if PLAT_GTK #ifdef __cplusplus extern "C" { #endif #define SCINTILLA(obj) GTK_CHECK_CAST (obj, scintilla_get_type (), ScintillaObject) #define SCINTILLA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) #define IS_SCINTILLA(obj) GTK_CHECK_TYPE (obj, scintilla_get_type ()) typedef struct _ScintillaObject ScintillaObject; typedef struct _ScintillaClass ScintillaClass; struct _ScintillaObject { GtkContainer cont; void *pscin; }; struct _ScintillaClass { GtkContainerClass parent_class; void (* command) (ScintillaObject *ttt); void (* notify) (ScintillaObject *ttt); }; #if GLIB_MAJOR_VERSION < 2 GtkType scintilla_get_type (void); #else GType scintilla_get_type (void); #endif GtkWidget* scintilla_new (void); void scintilla_set_id (ScintillaObject *sci, uptr_t id); sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); void scintilla_release_resources(void); #if GTK_MAJOR_VERSION < 2 #define SCINTILLA_NOTIFY "notify" #else #define SCINTILLA_NOTIFY "sci-notify" #endif #ifdef __cplusplus } #endif #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/include/Accessor.h0000644000175000001440000000512511407213302022675 0ustar subzerousers// Scintilla source code edit control /** @file Accessor.h ** Rapid easy access to contents of a Scintilla. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. enum { wsSpace = 1, wsTab = 2, wsSpaceTab = 4, wsInconsistent=8}; class Accessor; typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len); /** * Interface to data in a Scintilla. */ class Accessor { protected: enum {extremePosition=0x7FFFFFFF}; /** @a bufferSize is a trade off between time taken to copy the characters * and retrieval overhead. * @a slopSize positions the buffer before the desired position * in case there is some backtracking. */ enum {bufferSize=4000, slopSize=bufferSize/8}; char buf[bufferSize+1]; int startPos; int endPos; int codePage; virtual bool InternalIsLeadByte(char ch)=0; virtual void Fill(int position)=0; public: Accessor() : startPos(extremePosition), endPos(0), codePage(0) {} virtual ~Accessor() {} char operator[](int position) { if (position < startPos || position >= endPos) { Fill(position); } return buf[position - startPos]; } /** Safe version of operator[], returning a defined value for invalid position. */ char SafeGetCharAt(int position, char chDefault=' ') { if (position < startPos || position >= endPos) { Fill(position); if (position < startPos || position >= endPos) { // Position is outside range of document return chDefault; } } return buf[position - startPos]; } bool IsLeadByte(char ch) { return codePage && InternalIsLeadByte(ch); } void SetCodePage(int codePage_) { codePage = codePage_; } virtual bool Match(int pos, const char *s)=0; virtual char StyleAt(int position)=0; virtual int GetLine(int position)=0; virtual int LineStart(int line)=0; virtual int LevelAt(int line)=0; virtual int Length()=0; virtual void Flush()=0; virtual int GetLineState(int line)=0; virtual int SetLineState(int line, int state)=0; virtual int GetPropertyInt(const char *key, int defaultValue=0)=0; virtual char *GetProperties()=0; // Style setting virtual void StartAt(unsigned int start, char chMask=31)=0; virtual void SetFlags(char chFlags_, char chWhile_)=0; virtual unsigned int GetStartSegment()=0; virtual void StartSegment(unsigned int pos)=0; virtual void ColourTo(unsigned int pos, int chAttr)=0; virtual void SetLevel(int line, int level)=0; virtual int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0)=0; virtual void IndicatorFill(int start, int end, int indicator, int value)=0; }; sqliteman-1.2.2/sqliteman/qscintilla2/include/PropSet.h0000644000175000001440000000641311407213302022530 0ustar subzerousers// Scintilla source code edit control /** @file PropSet.h ** A Java style properties file module. **/ // Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef PROPSET_H #define PROPSET_H #include "SString.h" bool EqualCaseInsensitive(const char *a, const char *b); bool isprefix(const char *target, const char *prefix); #ifdef SCI_NAMESPACE namespace Scintilla { #endif struct Property { unsigned int hash; char *key; char *val; Property *next; Property() : hash(0), key(0), val(0), next(0) {} }; /** */ class PropSet { protected: enum { hashRoots=31 }; Property *props[hashRoots]; Property *enumnext; int enumhash; static bool caseSensitiveFilenames; static unsigned int HashString(const char *s, size_t len) { unsigned int ret = 0; while (len--) { ret <<= 4; ret ^= *s; s++; } return ret; } static bool IncludesVar(const char *value, const char *key); public: PropSet *superPS; PropSet(); ~PropSet(); void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1); void Set(const char *keyVal); void Unset(const char *key, int lenKey=-1); void SetMultiple(const char *s); SString Get(const char *key); SString GetExpanded(const char *key); SString Expand(const char *withVars, int maxExpands=100); int GetInt(const char *key, int defaultValue=0); SString GetWild(const char *keybase, const char *filename); SString GetNewExpand(const char *keybase, const char *filename=""); void Clear(); char *ToString(); // Caller must delete[] the return value bool GetFirst(char **key, char **val); bool GetNext(char **key, char **val); static void SetCaseSensitiveFilenames(bool caseSensitiveFilenames_) { caseSensitiveFilenames = caseSensitiveFilenames_; } private: // copy-value semantics not implemented PropSet(const PropSet ©); void operator=(const PropSet &assign); }; /** */ class WordList { public: // Each word contains at least one character - a empty word acts as sentinel at the end. char **words; char **wordsNoCase; char *list; int len; bool onlyLineEnds; ///< Delimited by any white space or only line ends bool sorted; bool sortedNoCase; int starts[256]; WordList(bool onlyLineEnds_ = false) : words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), sorted(false), sortedNoCase(false) {} ~WordList() { Clear(); } operator bool() { return len ? true : false; } char *operator[](int ind) { return words[ind]; } void Clear(); void Set(const char *s); char *Allocate(int size); void SetFromAllocated(); bool InList(const char *s); bool InListAbbreviated(const char *s, const char marker); const char *GetNearestWord(const char *wordStart, int searchLen, bool ignoreCase = false, SString wordCharacters="", int wordIndex = -1); char *GetNearestWords(const char *wordStart, int searchLen, bool ignoreCase=false, char otherSeparator='\0', bool exactLen=false); }; inline bool IsAlphabetic(unsigned int ch) { return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z')); } #ifdef SCI_NAMESPACE } #endif #ifdef _MSC_VER // Visual C++ doesn't like the private copy idiom for disabling // the default copy constructor and operator=, but it's fine. #pragma warning(disable: 4511 4512) #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/include/WindowAccessor.h0000644000175000001440000000363011407213302024064 0ustar subzerousers// Scintilla source code edit control /** @file WindowAccessor.h ** Implementation of BufferAccess and StylingAccess on a Scintilla ** rapid easy access to contents of a Scintilla. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifdef SCI_NAMESPACE namespace Scintilla { #endif /** */ class WindowAccessor : public Accessor { // Private so WindowAccessor objects can not be copied WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} WindowAccessor &operator=(const WindowAccessor &) { return *this; } protected: WindowID id; PropSet &props; int lenDoc; char styleBuf[bufferSize]; int validLen; char chFlags; char chWhile; unsigned int startSeg; bool InternalIsLeadByte(char ch); void Fill(int position); public: WindowAccessor(WindowID id_, PropSet &props_) : Accessor(), id(id_), props(props_), lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { } ~WindowAccessor(); bool Match(int pos, const char *s); char StyleAt(int position); int GetLine(int position); int LineStart(int line); int LevelAt(int line); int Length(); void Flush(); int GetLineState(int line); int SetLineState(int line, int state); int GetPropertyInt(const char *key, int defaultValue=0) { return props.GetInt(key, defaultValue); } char *GetProperties() { return props.ToString(); } void StartAt(unsigned int start, char chMask=31); void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; unsigned int GetStartSegment() { return startSeg; } void StartSegment(unsigned int pos); void ColourTo(unsigned int pos, int chAttr); void SetLevel(int line, int level); int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); void IndicatorFill(int start, int end, int indicator, int value); }; #ifdef SCI_NAMESPACE } #endif sqliteman-1.2.2/sqliteman/qscintilla2/include/Face.py0000644000175000001440000000626511407213302022200 0ustar subzerousers# Module for reading and parsing Scintilla.iface file import string def sanitiseLine(line): if line[-1:] == '\n': line = line[:-1] if string.find(line, "##") != -1: line = line[:string.find(line, "##")] line = string.strip(line) return line def decodeFunction(featureVal): retType, rest = string.split(featureVal, " ", 1) nameIdent, params = string.split(rest, "(") name, value = string.split(nameIdent, "=") params, rest = string.split(params, ")") param1, param2 = string.split(params, ",")[0:2] return retType, name, value, param1, param2 def decodeEvent(featureVal): retType, rest = string.split(featureVal, " ", 1) nameIdent, params = string.split(rest, "(") name, value = string.split(nameIdent, "=") return retType, name, value def decodeParam(p): param = string.strip(p) type = "" name = "" value = "" if " " in param: type, nv = string.split(param, " ") if "=" in nv: name, value = string.split(nv, "=") else: name = nv return type, name, value class Face: def __init__(self): self.order = [] self.features = {} self.values = {} self.events = {} def ReadFromFile(self, name): currentCategory = "" currentComment = [] currentCommentFinished = 0 file = open(name) for line in file.readlines(): line = sanitiseLine(line) if line: if line[0] == "#": if line[1] == " ": if currentCommentFinished: currentComment = [] currentCommentFinished = 0 currentComment.append(line[2:]) else: currentCommentFinished = 1 featureType, featureVal = string.split(line, " ", 1) if featureType in ["fun", "get", "set"]: retType, name, value, param1, param2 = decodeFunction(featureVal) p1 = decodeParam(param1) p2 = decodeParam(param2) self.features[name] = { "FeatureType": featureType, "ReturnType": retType, "Value": value, "Param1Type": p1[0], "Param1Name": p1[1], "Param1Value": p1[2], "Param2Type": p2[0], "Param2Name": p2[1], "Param2Value": p2[2], "Category": currentCategory, "Comment": currentComment } if self.values.has_key(value): raise "Duplicate value " + value + " " + name self.values[value] = 1 self.order.append(name) elif featureType == "evt": retType, name, value = decodeEvent(featureVal) self.features[name] = { "FeatureType": featureType, "ReturnType": retType, "Value": value, "Category": currentCategory, "Comment": currentComment } if self.events.has_key(value): raise "Duplicate event " + value + " " + name self.events[value] = 1 self.order.append(name) elif featureType == "cat": currentCategory = featureVal elif featureType == "val": name, value = string.split(featureVal, "=", 1) self.features[name] = { "FeatureType": featureType, "Category": currentCategory, "Value": value } self.order.append(name) elif featureType == "enu" or featureType == "lex": name, value = string.split(featureVal, "=", 1) self.features[name] = { "FeatureType": featureType, "Category": currentCategory, "Value": value } self.order.append(name) sqliteman-1.2.2/sqliteman/qscintilla2/include/License.txt0000644000175000001440000000154411407213302023106 0ustar subzerousersLicense for Scintilla and SciTE Copyright 1998-2003 by Neil Hodgson All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. sqliteman-1.2.2/sqliteman/qscintilla2/include/KeyWords.h0000644000175000001440000000530311407213302022700 0ustar subzerousers// Scintilla source code edit control /** @file KeyWords.h ** Colourise for particular languages. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifdef SCI_NAMESPACE namespace Scintilla { #endif typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler); /** * A LexerModule is responsible for lexing and folding a particular language. * The class maintains a list of LexerModules which can be searched to find a * module appropriate to a particular language. */ class LexerModule { protected: const LexerModule *next; int language; LexerFunction fnLexer; LexerFunction fnFolder; const char * const * wordListDescriptions; int styleBits; static const LexerModule *base; static int nextLanguage; public: const char *languageName; LexerModule(int language_, LexerFunction fnLexer_, const char *languageName_=0, LexerFunction fnFolder_=0, const char * const wordListDescriptions_[] = NULL, int styleBits_=5); virtual ~LexerModule() { } int GetLanguage() const { return language; } // -1 is returned if no WordList information is available int GetNumWordLists() const; const char *GetWordListDescription(int index) const; int GetStyleBitsNeeded() const; virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const; virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const; static const LexerModule *Find(int language); static const LexerModule *Find(const char *languageName); }; #ifdef SCI_NAMESPACE } #endif /** * Check if a character is a space. * This is ASCII specific but is safe with chars >= 0x80. */ inline bool isspacechar(unsigned char ch) { return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); } inline bool iswordchar(char ch) { return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_'); } inline bool iswordstart(char ch) { return isascii(ch) && (isalnum(ch) || ch == '_'); } inline bool isoperator(char ch) { if (isascii(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '(' || ch == ')' || ch == '-' || ch == '+' || ch == '=' || ch == '|' || ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == ':' || ch == ';' || ch == '<' || ch == '>' || ch == ',' || ch == '/' || ch == '?' || ch == '!' || ch == '.' || ch == '~') return true; return false; } sqliteman-1.2.2/sqliteman/qscintilla2/include/SString.h0000644000175000001440000002044311407213302022524 0ustar subzerousers// SciTE - Scintilla based Text Editor /** @file SString.h ** A simple string class. **/ // Copyright 1998-2004 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef SSTRING_H #define SSTRING_H // These functions are implemented because each platform calls them something different. int CompareCaseInsensitive(const char *a, const char *b); int CompareNCaseInsensitive(const char *a, const char *b, size_t len); bool EqualCaseInsensitive(const char *a, const char *b); #ifdef SCI_NAMESPACE namespace Scintilla { #endif // Define another string class. // While it would be 'better' to use std::string, that doubles the executable size. // An SString may contain embedded nul characters. /** * Base class from which the two other classes (SBuffer & SString) * are derived. */ class SContainer { public: /** Type of string lengths (sizes) and positions (indexes). */ typedef size_t lenpos_t; /** Out of bounds value indicating that the string argument should be measured. */ enum { measure_length=0xffffffffU}; protected: char *s; ///< The C string lenpos_t sSize; ///< The size of the buffer, less 1: ie. the maximum size of the string SContainer() : s(0), sSize(0) {} ~SContainer() { delete []s; // Suppose it was allocated using StringAllocate s = 0; sSize = 0; } /** Size of buffer. */ lenpos_t size() const { if (s) { return sSize; } else { return 0; } } public: /** * Allocate uninitialized memory big enough to fit a string of the given length. * @return the pointer to the new string */ static char *StringAllocate(lenpos_t len); /** * Duplicate a buffer/C string. * Allocate memory of the given size, or big enough to fit the string if length isn't given; * then copy the given string in the allocated memory. * @return the pointer to the new string */ static char *StringAllocate( const char *s, ///< The string to duplicate lenpos_t len=measure_length); ///< The length of memory to allocate. Optional. }; /** * @brief A string buffer class. * * Main use is to ask an API the length of a string it can provide, * then to allocate a buffer of the given size, and to provide this buffer * to the API to put the string. * This class is intended to be shortlived, to be transformed as SString * as soon as it holds the string, so it has little members. * Note: we assume the buffer is filled by the API. If the length can be shorter, * we should set sLen to strlen(sb.ptr()) in related SString constructor and assignment. */ class SBuffer : protected SContainer { public: SBuffer(lenpos_t len) { s = StringAllocate(len); if (s) { *s = '\0'; sSize = len; } else { sSize = 0; } } private: /// Copy constructor // Here only to be on the safe size, user should avoid returning SBuffer values. SBuffer(const SBuffer &source) : SContainer() { s = StringAllocate(source.s, source.sSize); sSize = (s) ? source.sSize : 0; } /// Default assignment operator // Same here, shouldn't be used SBuffer &operator=(const SBuffer &source) { if (this != &source) { delete []s; s = StringAllocate(source.s, source.sSize); sSize = (s) ? source.sSize : 0; } return *this; } public: /** Provide direct read/write access to buffer. */ char *ptr() { return s; } /** Ownership of the buffer have been taken, so release it. */ void reset() { s = 0; sSize = 0; } /** Size of buffer. */ lenpos_t size() const { return SContainer::size(); } }; /** * @brief A simple string class. * * Hold the length of the string for quick operations, * can have a buffer bigger than the string to avoid too many memory allocations and copies. * May have embedded zeroes as a result of @a substitute, but relies too heavily on C string * functions to allow reliable manipulations of these strings, other than simple appends, etc. */ class SString : protected SContainer { lenpos_t sLen; ///< The size of the string in s lenpos_t sizeGrowth; ///< Minimum growth size when appending strings enum { sizeGrowthDefault = 64 }; bool grow(lenpos_t lenNew); SString &assign(const char *sOther, lenpos_t sSize_=measure_length); public: SString() : sLen(0), sizeGrowth(sizeGrowthDefault) {} SString(const SString &source) : SContainer(), sizeGrowth(sizeGrowthDefault) { s = StringAllocate(source.s, source.sLen); sSize = sLen = (s) ? source.sLen : 0; } SString(const char *s_) : sizeGrowth(sizeGrowthDefault) { s = StringAllocate(s_); sSize = sLen = (s) ? strlen(s) : 0; } SString(SBuffer &buf) : sizeGrowth(sizeGrowthDefault) { s = buf.ptr(); sSize = sLen = buf.size(); // Consumes the given buffer! buf.reset(); } SString(const char *s_, lenpos_t first, lenpos_t last) : sizeGrowth(sizeGrowthDefault) { // note: expects the "last" argument to point one beyond the range end (a la STL iterators) s = StringAllocate(s_ + first, last - first); sSize = sLen = (s) ? last - first : 0; } SString(int i); SString(double d, int precision); ~SString() { sLen = 0; } void clear() { if (s) { *s = '\0'; } sLen = 0; } /** Size of buffer. */ lenpos_t size() const { return SContainer::size(); } /** Size of string in buffer. */ lenpos_t length() const { return sLen; } /** Read access to a character of the string. */ char operator[](lenpos_t i) const { return (s && i < sSize) ? s[i] : '\0'; } SString &operator=(const char *source) { return assign(source); } SString &operator=(const SString &source) { if (this != &source) { assign(source.s, source.sLen); } return *this; } bool operator==(const SString &sOther) const; bool operator!=(const SString &sOther) const { return !operator==(sOther); } bool operator==(const char *sOther) const; bool operator!=(const char *sOther) const { return !operator==(sOther); } bool contains(char ch) const { return (s && *s) ? strchr(s, ch) != 0 : false; } void setsizegrowth(lenpos_t sizeGrowth_) { sizeGrowth = sizeGrowth_; } const char *c_str() const { return s ? s : ""; } /** Give ownership of buffer to caller which must use delete[] to free buffer. */ char *detach() { char *sRet = s; s = 0; sSize = 0; sLen = 0; return sRet; } SString substr(lenpos_t subPos, lenpos_t subLen=measure_length) const; SString &lowercase(lenpos_t subPos = 0, lenpos_t subLen=measure_length); SString &uppercase(lenpos_t subPos = 0, lenpos_t subLen=measure_length); SString &append(const char *sOther, lenpos_t sLenOther=measure_length, char sep = '\0'); SString &operator+=(const char *sOther) { return append(sOther, static_cast(measure_length)); } SString &operator+=(const SString &sOther) { return append(sOther.s, sOther.sLen); } SString &operator+=(char ch) { return append(&ch, 1); } SString &appendwithseparator(const char *sOther, char sep) { return append(sOther, strlen(sOther), sep); } SString &insert(lenpos_t pos, const char *sOther, lenpos_t sLenOther=measure_length); /** * Remove @a len characters from the @a pos position, included. * Characters at pos + len and beyond replace characters at pos. * If @a len is 0, or greater than the length of the string * starting at @a pos, the string is just truncated at @a pos. */ void remove(lenpos_t pos, lenpos_t len); SString &change(lenpos_t pos, char ch) { if (pos < sLen) { // character changed must be in string bounds *(s + pos) = ch; } return *this; } /** Read an integral numeric value from the string. */ int value() const { return s ? atoi(s) : 0; } bool startswith(const char *prefix); bool endswith(const char *suffix); int search(const char *sFind, lenpos_t start=0) const; bool contains(const char *sFind) const { return search(sFind) >= 0; } int substitute(char chFind, char chReplace); int substitute(const char *sFind, const char *sReplace); int remove(const char *sFind) { return substitute(sFind, ""); } }; /** * Duplicate a C string. * Allocate memory of the given size, or big enough to fit the string if length isn't given; * then copy the given string in the allocated memory. * @return the pointer to the new string */ inline char *StringDup( const char *s, ///< The string to duplicate SContainer::lenpos_t len=SContainer::measure_length) ///< The length of memory to allocate. Optional. { return SContainer::StringAllocate(s, len); } #ifdef SCI_NAMESPACE } #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/include/HFacer.py0000644000175000001440000000440711407213302022466 0ustar subzerousers# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface # definition file. # The header files are copied to a temporary file apart from the section between a //++Autogenerated # comment and a //--Autogenerated comment which is generated by the printHFile and printLexHFile # functions. After the temporary file is created, it is copied back to the original file name. import string import sys import os import Face def Contains(s,sub): return string.find(s, sub) != -1 def printLexHFile(f,out): for name in f.order: v = f.features[name] if v["FeatureType"] in ["val"]: if Contains(name, "SCE_") or Contains(name, "SCLEX_"): out.write("#define " + name + " " + v["Value"] + "\n") def printHFile(f,out): for name in f.order: v = f.features[name] if v["Category"] != "Deprecated": if v["FeatureType"] in ["fun", "get", "set"]: featureDefineName = "SCI_" + string.upper(name) out.write("#define " + featureDefineName + " " + v["Value"] + "\n") elif v["FeatureType"] in ["evt"]: featureDefineName = "SCN_" + string.upper(name) out.write("#define " + featureDefineName + " " + v["Value"] + "\n") elif v["FeatureType"] in ["val"]: if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): out.write("#define " + name + " " + v["Value"] + "\n") def CopyWithInsertion(input, output, genfn, definition): copying = 1 for line in input.readlines(): if copying: output.write(line) if Contains(line, "//++Autogenerated"): copying = 0 genfn(definition, output) if Contains(line, "//--Autogenerated"): copying = 1 output.write(line) def contents(filename): f = file(filename) t = f.read() f.close() return t def Regenerate(filename, genfn, definition): inText = contents(filename) tempname = "HFacer.tmp" out = open(tempname,"w") hfile = open(filename) CopyWithInsertion(hfile, out, genfn, definition) out.close() hfile.close() outText = contents(tempname) if inText == outText: os.unlink(tempname) else: os.unlink(filename) os.rename(tempname, filename) f = Face.Face() try: f.ReadFromFile("Scintilla.iface") Regenerate("Scintilla.h", printHFile, f) Regenerate("SciLexer.h", printLexHFile, f) print "Maximum ID is", max([x for x in f.values if int(x) < 3000]) except: raise sqliteman-1.2.2/sqliteman/qscintilla2/include/Scintilla.h0000644000175000001440000006074111407213302023062 0ustar subzerousers// Scintilla source code edit control /** @file Scintilla.h ** Interface to the edit control. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. // Most of this file is automatically generated from the Scintilla.iface interface definition // file which contains any comments about the definitions. HFacer.py does the generation. #ifndef SCINTILLA_H #define SCINTILLA_H #if LCCWIN typedef BOOL bool; #endif #if PLAT_WIN // Return false on failure: bool Scintilla_RegisterClasses(void *hInstance); bool Scintilla_ReleaseResources(); #endif int Scintilla_LinkLexers(); // Here should be placed typedefs for uptr_t, an unsigned integer type large enough to // hold a pointer and sptr_t, a signed integer large enough to hold a pointer. // May need to be changed for 64 bit platforms. #if _MSC_VER >= 1300 #include #endif #ifdef MAXULONG_PTR typedef ULONG_PTR uptr_t; typedef LONG_PTR sptr_t; #else typedef unsigned long uptr_t; typedef long sptr_t; #endif typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); //++Autogenerated -- start of section automatically generated from Scintilla.iface #define INVALID_POSITION -1 #define SCI_START 2000 #define SCI_OPTIONAL_START 3000 #define SCI_LEXER_START 4000 #define SCI_ADDTEXT 2001 #define SCI_ADDSTYLEDTEXT 2002 #define SCI_INSERTTEXT 2003 #define SCI_CLEARALL 2004 #define SCI_CLEARDOCUMENTSTYLE 2005 #define SCI_GETLENGTH 2006 #define SCI_GETCHARAT 2007 #define SCI_GETCURRENTPOS 2008 #define SCI_GETANCHOR 2009 #define SCI_GETSTYLEAT 2010 #define SCI_REDO 2011 #define SCI_SETUNDOCOLLECTION 2012 #define SCI_SELECTALL 2013 #define SCI_SETSAVEPOINT 2014 #define SCI_GETSTYLEDTEXT 2015 #define SCI_CANREDO 2016 #define SCI_MARKERLINEFROMHANDLE 2017 #define SCI_MARKERDELETEHANDLE 2018 #define SCI_GETUNDOCOLLECTION 2019 #define SCWS_INVISIBLE 0 #define SCWS_VISIBLEALWAYS 1 #define SCWS_VISIBLEAFTERINDENT 2 #define SCI_GETVIEWWS 2020 #define SCI_SETVIEWWS 2021 #define SCI_POSITIONFROMPOINT 2022 #define SCI_POSITIONFROMPOINTCLOSE 2023 #define SCI_GOTOLINE 2024 #define SCI_GOTOPOS 2025 #define SCI_SETANCHOR 2026 #define SCI_GETCURLINE 2027 #define SCI_GETENDSTYLED 2028 #define SC_EOL_CRLF 0 #define SC_EOL_CR 1 #define SC_EOL_LF 2 #define SCI_CONVERTEOLS 2029 #define SCI_GETEOLMODE 2030 #define SCI_SETEOLMODE 2031 #define SCI_STARTSTYLING 2032 #define SCI_SETSTYLING 2033 #define SCI_GETBUFFEREDDRAW 2034 #define SCI_SETBUFFEREDDRAW 2035 #define SCI_SETTABWIDTH 2036 #define SCI_GETTABWIDTH 2121 #define SC_CP_UTF8 65001 #define SC_CP_DBCS 1 #define SCI_SETCODEPAGE 2037 #define SCI_SETUSEPALETTE 2039 #define MARKER_MAX 31 #define SC_MARK_CIRCLE 0 #define SC_MARK_ROUNDRECT 1 #define SC_MARK_ARROW 2 #define SC_MARK_SMALLRECT 3 #define SC_MARK_SHORTARROW 4 #define SC_MARK_EMPTY 5 #define SC_MARK_ARROWDOWN 6 #define SC_MARK_MINUS 7 #define SC_MARK_PLUS 8 #define SC_MARK_VLINE 9 #define SC_MARK_LCORNER 10 #define SC_MARK_TCORNER 11 #define SC_MARK_BOXPLUS 12 #define SC_MARK_BOXPLUSCONNECTED 13 #define SC_MARK_BOXMINUS 14 #define SC_MARK_BOXMINUSCONNECTED 15 #define SC_MARK_LCORNERCURVE 16 #define SC_MARK_TCORNERCURVE 17 #define SC_MARK_CIRCLEPLUS 18 #define SC_MARK_CIRCLEPLUSCONNECTED 19 #define SC_MARK_CIRCLEMINUS 20 #define SC_MARK_CIRCLEMINUSCONNECTED 21 #define SC_MARK_BACKGROUND 22 #define SC_MARK_DOTDOTDOT 23 #define SC_MARK_ARROWS 24 #define SC_MARK_PIXMAP 25 #define SC_MARK_FULLRECT 26 #define SC_MARK_CHARACTER 10000 #define SC_MARKNUM_FOLDEREND 25 #define SC_MARKNUM_FOLDEROPENMID 26 #define SC_MARKNUM_FOLDERMIDTAIL 27 #define SC_MARKNUM_FOLDERTAIL 28 #define SC_MARKNUM_FOLDERSUB 29 #define SC_MARKNUM_FOLDER 30 #define SC_MARKNUM_FOLDEROPEN 31 #define SC_MASK_FOLDERS 0xFE000000 #define SCI_MARKERDEFINE 2040 #define SCI_MARKERSETFORE 2041 #define SCI_MARKERSETBACK 2042 #define SCI_MARKERADD 2043 #define SCI_MARKERDELETE 2044 #define SCI_MARKERDELETEALL 2045 #define SCI_MARKERGET 2046 #define SCI_MARKERNEXT 2047 #define SCI_MARKERPREVIOUS 2048 #define SCI_MARKERDEFINEPIXMAP 2049 #define SCI_MARKERADDSET 2466 #define SCI_MARKERSETALPHA 2476 #define SC_MARGIN_SYMBOL 0 #define SC_MARGIN_NUMBER 1 #define SC_MARGIN_BACK 2 #define SC_MARGIN_FORE 3 #define SCI_SETMARGINTYPEN 2240 #define SCI_GETMARGINTYPEN 2241 #define SCI_SETMARGINWIDTHN 2242 #define SCI_GETMARGINWIDTHN 2243 #define SCI_SETMARGINMASKN 2244 #define SCI_GETMARGINMASKN 2245 #define SCI_SETMARGINSENSITIVEN 2246 #define SCI_GETMARGINSENSITIVEN 2247 #define STYLE_DEFAULT 32 #define STYLE_LINENUMBER 33 #define STYLE_BRACELIGHT 34 #define STYLE_BRACEBAD 35 #define STYLE_CONTROLCHAR 36 #define STYLE_INDENTGUIDE 37 #define STYLE_CALLTIP 38 #define STYLE_LASTPREDEFINED 39 #define STYLE_MAX 127 #define SC_CHARSET_ANSI 0 #define SC_CHARSET_DEFAULT 1 #define SC_CHARSET_BALTIC 186 #define SC_CHARSET_CHINESEBIG5 136 #define SC_CHARSET_EASTEUROPE 238 #define SC_CHARSET_GB2312 134 #define SC_CHARSET_GREEK 161 #define SC_CHARSET_HANGUL 129 #define SC_CHARSET_MAC 77 #define SC_CHARSET_OEM 255 #define SC_CHARSET_RUSSIAN 204 #define SC_CHARSET_CYRILLIC 1251 #define SC_CHARSET_SHIFTJIS 128 #define SC_CHARSET_SYMBOL 2 #define SC_CHARSET_TURKISH 162 #define SC_CHARSET_JOHAB 130 #define SC_CHARSET_HEBREW 177 #define SC_CHARSET_ARABIC 178 #define SC_CHARSET_VIETNAMESE 163 #define SC_CHARSET_THAI 222 #define SC_CHARSET_8859_15 1000 #define SCI_STYLECLEARALL 2050 #define SCI_STYLESETFORE 2051 #define SCI_STYLESETBACK 2052 #define SCI_STYLESETBOLD 2053 #define SCI_STYLESETITALIC 2054 #define SCI_STYLESETSIZE 2055 #define SCI_STYLESETFONT 2056 #define SCI_STYLESETEOLFILLED 2057 #define SCI_STYLERESETDEFAULT 2058 #define SCI_STYLESETUNDERLINE 2059 #define SC_CASE_MIXED 0 #define SC_CASE_UPPER 1 #define SC_CASE_LOWER 2 #define SCI_STYLEGETFORE 2481 #define SCI_STYLEGETBACK 2482 #define SCI_STYLEGETBOLD 2483 #define SCI_STYLEGETITALIC 2484 #define SCI_STYLEGETSIZE 2485 #define SCI_STYLEGETFONT 2486 #define SCI_STYLEGETEOLFILLED 2487 #define SCI_STYLEGETUNDERLINE 2488 #define SCI_STYLEGETCASE 2489 #define SCI_STYLEGETCHARACTERSET 2490 #define SCI_STYLEGETVISIBLE 2491 #define SCI_STYLEGETCHANGEABLE 2492 #define SCI_STYLEGETHOTSPOT 2493 #define SCI_STYLESETCASE 2060 #define SCI_STYLESETCHARACTERSET 2066 #define SCI_STYLESETHOTSPOT 2409 #define SCI_SETSELFORE 2067 #define SCI_SETSELBACK 2068 #define SCI_GETSELALPHA 2477 #define SCI_SETSELALPHA 2478 #define SCI_GETSELEOLFILLED 2479 #define SCI_SETSELEOLFILLED 2480 #define SCI_SETCARETFORE 2069 #define SCI_ASSIGNCMDKEY 2070 #define SCI_CLEARCMDKEY 2071 #define SCI_CLEARALLCMDKEYS 2072 #define SCI_SETSTYLINGEX 2073 #define SCI_STYLESETVISIBLE 2074 #define SCI_GETCARETPERIOD 2075 #define SCI_SETCARETPERIOD 2076 #define SCI_SETWORDCHARS 2077 #define SCI_BEGINUNDOACTION 2078 #define SCI_ENDUNDOACTION 2079 #define INDIC_PLAIN 0 #define INDIC_SQUIGGLE 1 #define INDIC_TT 2 #define INDIC_DIAGONAL 3 #define INDIC_STRIKE 4 #define INDIC_HIDDEN 5 #define INDIC_BOX 6 #define INDIC_ROUNDBOX 7 #define INDIC_MAX 31 #define INDIC_CONTAINER 8 #define INDIC0_MASK 0x20 #define INDIC1_MASK 0x40 #define INDIC2_MASK 0x80 #define INDICS_MASK 0xE0 #define SCI_INDICSETSTYLE 2080 #define SCI_INDICGETSTYLE 2081 #define SCI_INDICSETFORE 2082 #define SCI_INDICGETFORE 2083 #define SCI_INDICSETUNDER 2510 #define SCI_INDICGETUNDER 2511 #define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEBACK 2085 #define SCI_SETSTYLEBITS 2090 #define SCI_GETSTYLEBITS 2091 #define SCI_SETLINESTATE 2092 #define SCI_GETLINESTATE 2093 #define SCI_GETMAXLINESTATE 2094 #define SCI_GETCARETLINEVISIBLE 2095 #define SCI_SETCARETLINEVISIBLE 2096 #define SCI_GETCARETLINEBACK 2097 #define SCI_SETCARETLINEBACK 2098 #define SCI_STYLESETCHANGEABLE 2099 #define SCI_AUTOCSHOW 2100 #define SCI_AUTOCCANCEL 2101 #define SCI_AUTOCACTIVE 2102 #define SCI_AUTOCPOSSTART 2103 #define SCI_AUTOCCOMPLETE 2104 #define SCI_AUTOCSTOPS 2105 #define SCI_AUTOCSETSEPARATOR 2106 #define SCI_AUTOCGETSEPARATOR 2107 #define SCI_AUTOCSELECT 2108 #define SCI_AUTOCSETCANCELATSTART 2110 #define SCI_AUTOCGETCANCELATSTART 2111 #define SCI_AUTOCSETFILLUPS 2112 #define SCI_AUTOCSETCHOOSESINGLE 2113 #define SCI_AUTOCGETCHOOSESINGLE 2114 #define SCI_AUTOCSETIGNORECASE 2115 #define SCI_AUTOCGETIGNORECASE 2116 #define SCI_USERLISTSHOW 2117 #define SCI_AUTOCSETAUTOHIDE 2118 #define SCI_AUTOCGETAUTOHIDE 2119 #define SCI_AUTOCSETDROPRESTOFWORD 2270 #define SCI_AUTOCGETDROPRESTOFWORD 2271 #define SCI_REGISTERIMAGE 2405 #define SCI_CLEARREGISTEREDIMAGES 2408 #define SCI_AUTOCGETTYPESEPARATOR 2285 #define SCI_AUTOCSETTYPESEPARATOR 2286 #define SCI_AUTOCSETMAXWIDTH 2208 #define SCI_AUTOCGETMAXWIDTH 2209 #define SCI_AUTOCSETMAXHEIGHT 2210 #define SCI_AUTOCGETMAXHEIGHT 2211 #define SCI_SETINDENT 2122 #define SCI_GETINDENT 2123 #define SCI_SETUSETABS 2124 #define SCI_GETUSETABS 2125 #define SCI_SETLINEINDENTATION 2126 #define SCI_GETLINEINDENTATION 2127 #define SCI_GETLINEINDENTPOSITION 2128 #define SCI_GETCOLUMN 2129 #define SCI_SETHSCROLLBAR 2130 #define SCI_GETHSCROLLBAR 2131 #define SCI_SETINDENTATIONGUIDES 2132 #define SCI_GETINDENTATIONGUIDES 2133 #define SCI_SETHIGHLIGHTGUIDE 2134 #define SCI_GETHIGHLIGHTGUIDE 2135 #define SCI_GETLINEENDPOSITION 2136 #define SCI_GETCODEPAGE 2137 #define SCI_GETCARETFORE 2138 #define SCI_GETUSEPALETTE 2139 #define SCI_GETREADONLY 2140 #define SCI_SETCURRENTPOS 2141 #define SCI_SETSELECTIONSTART 2142 #define SCI_GETSELECTIONSTART 2143 #define SCI_SETSELECTIONEND 2144 #define SCI_GETSELECTIONEND 2145 #define SCI_SETPRINTMAGNIFICATION 2146 #define SCI_GETPRINTMAGNIFICATION 2147 #define SC_PRINT_NORMAL 0 #define SC_PRINT_INVERTLIGHT 1 #define SC_PRINT_BLACKONWHITE 2 #define SC_PRINT_COLOURONWHITE 3 #define SC_PRINT_COLOURONWHITEDEFAULTBG 4 #define SCI_SETPRINTCOLOURMODE 2148 #define SCI_GETPRINTCOLOURMODE 2149 #define SCFIND_WHOLEWORD 2 #define SCFIND_MATCHCASE 4 #define SCFIND_WORDSTART 0x00100000 #define SCFIND_REGEXP 0x00200000 #define SCFIND_POSIX 0x00400000 #define SCI_FINDTEXT 2150 #define SCI_FORMATRANGE 2151 #define SCI_GETFIRSTVISIBLELINE 2152 #define SCI_GETLINE 2153 #define SCI_GETLINECOUNT 2154 #define SCI_SETMARGINLEFT 2155 #define SCI_GETMARGINLEFT 2156 #define SCI_SETMARGINRIGHT 2157 #define SCI_GETMARGINRIGHT 2158 #define SCI_GETMODIFY 2159 #define SCI_SETSEL 2160 #define SCI_GETSELTEXT 2161 #define SCI_GETTEXTRANGE 2162 #define SCI_HIDESELECTION 2163 #define SCI_POINTXFROMPOSITION 2164 #define SCI_POINTYFROMPOSITION 2165 #define SCI_LINEFROMPOSITION 2166 #define SCI_POSITIONFROMLINE 2167 #define SCI_LINESCROLL 2168 #define SCI_SCROLLCARET 2169 #define SCI_REPLACESEL 2170 #define SCI_SETREADONLY 2171 #define SCI_NULL 2172 #define SCI_CANPASTE 2173 #define SCI_CANUNDO 2174 #define SCI_EMPTYUNDOBUFFER 2175 #define SCI_UNDO 2176 #define SCI_CUT 2177 #define SCI_COPY 2178 #define SCI_PASTE 2179 #define SCI_CLEAR 2180 #define SCI_SETTEXT 2181 #define SCI_GETTEXT 2182 #define SCI_GETTEXTLENGTH 2183 #define SCI_GETDIRECTFUNCTION 2184 #define SCI_GETDIRECTPOINTER 2185 #define SCI_SETOVERTYPE 2186 #define SCI_GETOVERTYPE 2187 #define SCI_SETCARETWIDTH 2188 #define SCI_GETCARETWIDTH 2189 #define SCI_SETTARGETSTART 2190 #define SCI_GETTARGETSTART 2191 #define SCI_SETTARGETEND 2192 #define SCI_GETTARGETEND 2193 #define SCI_REPLACETARGET 2194 #define SCI_REPLACETARGETRE 2195 #define SCI_SEARCHINTARGET 2197 #define SCI_SETSEARCHFLAGS 2198 #define SCI_GETSEARCHFLAGS 2199 #define SCI_CALLTIPSHOW 2200 #define SCI_CALLTIPCANCEL 2201 #define SCI_CALLTIPACTIVE 2202 #define SCI_CALLTIPPOSSTART 2203 #define SCI_CALLTIPSETHLT 2204 #define SCI_CALLTIPSETBACK 2205 #define SCI_CALLTIPSETFORE 2206 #define SCI_CALLTIPSETFOREHLT 2207 #define SCI_CALLTIPUSESTYLE 2212 #define SCI_VISIBLEFROMDOCLINE 2220 #define SCI_DOCLINEFROMVISIBLE 2221 #define SCI_WRAPCOUNT 2235 #define SC_FOLDLEVELBASE 0x400 #define SC_FOLDLEVELWHITEFLAG 0x1000 #define SC_FOLDLEVELHEADERFLAG 0x2000 #define SC_FOLDLEVELBOXHEADERFLAG 0x4000 #define SC_FOLDLEVELBOXFOOTERFLAG 0x8000 #define SC_FOLDLEVELCONTRACTED 0x10000 #define SC_FOLDLEVELUNINDENT 0x20000 #define SC_FOLDLEVELNUMBERMASK 0x0FFF #define SCI_SETFOLDLEVEL 2222 #define SCI_GETFOLDLEVEL 2223 #define SCI_GETLASTCHILD 2224 #define SCI_GETFOLDPARENT 2225 #define SCI_SHOWLINES 2226 #define SCI_HIDELINES 2227 #define SCI_GETLINEVISIBLE 2228 #define SCI_SETFOLDEXPANDED 2229 #define SCI_GETFOLDEXPANDED 2230 #define SCI_TOGGLEFOLD 2231 #define SCI_ENSUREVISIBLE 2232 #define SC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 #define SC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 #define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 #define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 #define SC_FOLDFLAG_LEVELNUMBERS 0x0040 #define SC_FOLDFLAG_BOX 0x0001 #define SCI_SETFOLDFLAGS 2233 #define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 #define SCI_SETTABINDENTS 2260 #define SCI_GETTABINDENTS 2261 #define SCI_SETBACKSPACEUNINDENTS 2262 #define SCI_GETBACKSPACEUNINDENTS 2263 #define SC_TIME_FOREVER 10000000 #define SCI_SETMOUSEDWELLTIME 2264 #define SCI_GETMOUSEDWELLTIME 2265 #define SCI_WORDSTARTPOSITION 2266 #define SCI_WORDENDPOSITION 2267 #define SC_WRAP_NONE 0 #define SC_WRAP_WORD 1 #define SC_WRAP_CHAR 2 #define SCI_SETWRAPMODE 2268 #define SCI_GETWRAPMODE 2269 #define SC_WRAPVISUALFLAG_NONE 0x0000 #define SC_WRAPVISUALFLAG_END 0x0001 #define SC_WRAPVISUALFLAG_START 0x0002 #define SCI_SETWRAPVISUALFLAGS 2460 #define SCI_GETWRAPVISUALFLAGS 2461 #define SC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 #define SC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001 #define SC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002 #define SCI_SETWRAPVISUALFLAGSLOCATION 2462 #define SCI_GETWRAPVISUALFLAGSLOCATION 2463 #define SCI_SETWRAPSTARTINDENT 2464 #define SCI_GETWRAPSTARTINDENT 2465 #define SC_CACHE_NONE 0 #define SC_CACHE_CARET 1 #define SC_CACHE_PAGE 2 #define SC_CACHE_DOCUMENT 3 #define SCI_SETLAYOUTCACHE 2272 #define SCI_GETLAYOUTCACHE 2273 #define SCI_SETSCROLLWIDTH 2274 #define SCI_GETSCROLLWIDTH 2275 #define SCI_TEXTWIDTH 2276 #define SCI_SETENDATLASTLINE 2277 #define SCI_GETENDATLASTLINE 2278 #define SCI_TEXTHEIGHT 2279 #define SCI_SETVSCROLLBAR 2280 #define SCI_GETVSCROLLBAR 2281 #define SCI_APPENDTEXT 2282 #define SCI_GETTWOPHASEDRAW 2283 #define SCI_SETTWOPHASEDRAW 2284 #define SCI_TARGETFROMSELECTION 2287 #define SCI_LINESJOIN 2288 #define SCI_LINESSPLIT 2289 #define SCI_SETFOLDMARGINCOLOUR 2290 #define SCI_SETFOLDMARGINHICOLOUR 2291 #define SCI_LINEDOWN 2300 #define SCI_LINEDOWNEXTEND 2301 #define SCI_LINEUP 2302 #define SCI_LINEUPEXTEND 2303 #define SCI_CHARLEFT 2304 #define SCI_CHARLEFTEXTEND 2305 #define SCI_CHARRIGHT 2306 #define SCI_CHARRIGHTEXTEND 2307 #define SCI_WORDLEFT 2308 #define SCI_WORDLEFTEXTEND 2309 #define SCI_WORDRIGHT 2310 #define SCI_WORDRIGHTEXTEND 2311 #define SCI_HOME 2312 #define SCI_HOMEEXTEND 2313 #define SCI_LINEEND 2314 #define SCI_LINEENDEXTEND 2315 #define SCI_DOCUMENTSTART 2316 #define SCI_DOCUMENTSTARTEXTEND 2317 #define SCI_DOCUMENTEND 2318 #define SCI_DOCUMENTENDEXTEND 2319 #define SCI_PAGEUP 2320 #define SCI_PAGEUPEXTEND 2321 #define SCI_PAGEDOWN 2322 #define SCI_PAGEDOWNEXTEND 2323 #define SCI_EDITTOGGLEOVERTYPE 2324 #define SCI_CANCEL 2325 #define SCI_DELETEBACK 2326 #define SCI_TAB 2327 #define SCI_BACKTAB 2328 #define SCI_NEWLINE 2329 #define SCI_FORMFEED 2330 #define SCI_VCHOME 2331 #define SCI_VCHOMEEXTEND 2332 #define SCI_ZOOMIN 2333 #define SCI_ZOOMOUT 2334 #define SCI_DELWORDLEFT 2335 #define SCI_DELWORDRIGHT 2336 #define SCI_LINECUT 2337 #define SCI_LINEDELETE 2338 #define SCI_LINETRANSPOSE 2339 #define SCI_LINEDUPLICATE 2404 #define SCI_LOWERCASE 2340 #define SCI_UPPERCASE 2341 #define SCI_LINESCROLLDOWN 2342 #define SCI_LINESCROLLUP 2343 #define SCI_DELETEBACKNOTLINE 2344 #define SCI_HOMEDISPLAY 2345 #define SCI_HOMEDISPLAYEXTEND 2346 #define SCI_LINEENDDISPLAY 2347 #define SCI_LINEENDDISPLAYEXTEND 2348 #define SCI_HOMEWRAP 2349 #define SCI_HOMEWRAPEXTEND 2450 #define SCI_LINEENDWRAP 2451 #define SCI_LINEENDWRAPEXTEND 2452 #define SCI_VCHOMEWRAP 2453 #define SCI_VCHOMEWRAPEXTEND 2454 #define SCI_LINECOPY 2455 #define SCI_MOVECARETINSIDEVIEW 2401 #define SCI_LINELENGTH 2350 #define SCI_BRACEHIGHLIGHT 2351 #define SCI_BRACEBADLIGHT 2352 #define SCI_BRACEMATCH 2353 #define SCI_GETVIEWEOL 2355 #define SCI_SETVIEWEOL 2356 #define SCI_GETDOCPOINTER 2357 #define SCI_SETDOCPOINTER 2358 #define SCI_SETMODEVENTMASK 2359 #define EDGE_NONE 0 #define EDGE_LINE 1 #define EDGE_BACKGROUND 2 #define SCI_GETEDGECOLUMN 2360 #define SCI_SETEDGECOLUMN 2361 #define SCI_GETEDGEMODE 2362 #define SCI_SETEDGEMODE 2363 #define SCI_GETEDGECOLOUR 2364 #define SCI_SETEDGECOLOUR 2365 #define SCI_SEARCHANCHOR 2366 #define SCI_SEARCHNEXT 2367 #define SCI_SEARCHPREV 2368 #define SCI_LINESONSCREEN 2370 #define SCI_USEPOPUP 2371 #define SCI_SELECTIONISRECTANGLE 2372 #define SCI_SETZOOM 2373 #define SCI_GETZOOM 2374 #define SCI_CREATEDOCUMENT 2375 #define SCI_ADDREFDOCUMENT 2376 #define SCI_RELEASEDOCUMENT 2377 #define SCI_GETMODEVENTMASK 2378 #define SCI_SETFOCUS 2380 #define SCI_GETFOCUS 2381 #define SCI_SETSTATUS 2382 #define SCI_GETSTATUS 2383 #define SCI_SETMOUSEDOWNCAPTURES 2384 #define SCI_GETMOUSEDOWNCAPTURES 2385 #define SC_CURSORNORMAL -1 #define SC_CURSORWAIT 4 #define SCI_SETCURSOR 2386 #define SCI_GETCURSOR 2387 #define SCI_SETCONTROLCHARSYMBOL 2388 #define SCI_GETCONTROLCHARSYMBOL 2389 #define SCI_WORDPARTLEFT 2390 #define SCI_WORDPARTLEFTEXTEND 2391 #define SCI_WORDPARTRIGHT 2392 #define SCI_WORDPARTRIGHTEXTEND 2393 #define VISIBLE_SLOP 0x01 #define VISIBLE_STRICT 0x04 #define SCI_SETVISIBLEPOLICY 2394 #define SCI_DELLINELEFT 2395 #define SCI_DELLINERIGHT 2396 #define SCI_SETXOFFSET 2397 #define SCI_GETXOFFSET 2398 #define SCI_CHOOSECARETX 2399 #define SCI_GRABFOCUS 2400 #define CARET_SLOP 0x01 #define CARET_STRICT 0x04 #define CARET_JUMPS 0x10 #define CARET_EVEN 0x08 #define SCI_SETXCARETPOLICY 2402 #define SCI_SETYCARETPOLICY 2403 #define SCI_SETPRINTWRAPMODE 2406 #define SCI_GETPRINTWRAPMODE 2407 #define SCI_SETHOTSPOTACTIVEFORE 2410 #define SCI_GETHOTSPOTACTIVEFORE 2494 #define SCI_SETHOTSPOTACTIVEBACK 2411 #define SCI_GETHOTSPOTACTIVEBACK 2495 #define SCI_SETHOTSPOTACTIVEUNDERLINE 2412 #define SCI_GETHOTSPOTACTIVEUNDERLINE 2496 #define SCI_SETHOTSPOTSINGLELINE 2421 #define SCI_GETHOTSPOTSINGLELINE 2497 #define SCI_PARADOWN 2413 #define SCI_PARADOWNEXTEND 2414 #define SCI_PARAUP 2415 #define SCI_PARAUPEXTEND 2416 #define SCI_POSITIONBEFORE 2417 #define SCI_POSITIONAFTER 2418 #define SCI_COPYRANGE 2419 #define SCI_COPYTEXT 2420 #define SC_SEL_STREAM 0 #define SC_SEL_RECTANGLE 1 #define SC_SEL_LINES 2 #define SCI_SETSELECTIONMODE 2422 #define SCI_GETSELECTIONMODE 2423 #define SCI_GETLINESELSTARTPOSITION 2424 #define SCI_GETLINESELENDPOSITION 2425 #define SCI_LINEDOWNRECTEXTEND 2426 #define SCI_LINEUPRECTEXTEND 2427 #define SCI_CHARLEFTRECTEXTEND 2428 #define SCI_CHARRIGHTRECTEXTEND 2429 #define SCI_HOMERECTEXTEND 2430 #define SCI_VCHOMERECTEXTEND 2431 #define SCI_LINEENDRECTEXTEND 2432 #define SCI_PAGEUPRECTEXTEND 2433 #define SCI_PAGEDOWNRECTEXTEND 2434 #define SCI_STUTTEREDPAGEUP 2435 #define SCI_STUTTEREDPAGEUPEXTEND 2436 #define SCI_STUTTEREDPAGEDOWN 2437 #define SCI_STUTTEREDPAGEDOWNEXTEND 2438 #define SCI_WORDLEFTEND 2439 #define SCI_WORDLEFTENDEXTEND 2440 #define SCI_WORDRIGHTEND 2441 #define SCI_WORDRIGHTENDEXTEND 2442 #define SCI_SETWHITESPACECHARS 2443 #define SCI_SETCHARSDEFAULT 2444 #define SCI_AUTOCGETCURRENT 2445 #define SCI_ALLOCATE 2446 #define SCI_TARGETASUTF8 2447 #define SCI_SETLENGTHFORENCODE 2448 #define SCI_ENCODEDFROMUTF8 2449 #define SCI_FINDCOLUMN 2456 #define SCI_GETCARETSTICKY 2457 #define SCI_SETCARETSTICKY 2458 #define SCI_TOGGLECARETSTICKY 2459 #define SCI_SETPASTECONVERTENDINGS 2467 #define SCI_GETPASTECONVERTENDINGS 2468 #define SCI_SELECTIONDUPLICATE 2469 #define SC_ALPHA_TRANSPARENT 0 #define SC_ALPHA_OPAQUE 255 #define SC_ALPHA_NOALPHA 256 #define SCI_SETCARETLINEBACKALPHA 2470 #define SCI_GETCARETLINEBACKALPHA 2471 #define CARETSTYLE_INVISIBLE 0 #define CARETSTYLE_LINE 1 #define CARETSTYLE_BLOCK 2 #define SCI_SETCARETSTYLE 2512 #define SCI_GETCARETSTYLE 2513 #define SCI_SETINDICATORCURRENT 2500 #define SCI_GETINDICATORCURRENT 2501 #define SCI_SETINDICATORVALUE 2502 #define SCI_GETINDICATORVALUE 2503 #define SCI_INDICATORFILLRANGE 2504 #define SCI_INDICATORCLEARRANGE 2505 #define SCI_INDICATORALLONFOR 2506 #define SCI_INDICATORVALUEAT 2507 #define SCI_INDICATORSTART 2508 #define SCI_INDICATOREND 2509 #define SCI_SETPOSITIONCACHE 2514 #define SCI_GETPOSITIONCACHE 2515 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 #define SCI_GETLEXER 4002 #define SCI_COLOURISE 4003 #define SCI_SETPROPERTY 4004 #define KEYWORDSET_MAX 8 #define SCI_SETKEYWORDS 4005 #define SCI_SETLEXERLANGUAGE 4006 #define SCI_LOADLEXERLIBRARY 4007 #define SCI_GETPROPERTY 4008 #define SCI_GETPROPERTYEXPANDED 4009 #define SCI_GETPROPERTYINT 4010 #define SCI_GETSTYLEBITSNEEDED 4011 #define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_DELETETEXT 0x2 #define SC_MOD_CHANGESTYLE 0x4 #define SC_MOD_CHANGEFOLD 0x8 #define SC_PERFORMED_USER 0x10 #define SC_PERFORMED_UNDO 0x20 #define SC_PERFORMED_REDO 0x40 #define SC_MULTISTEPUNDOREDO 0x80 #define SC_LASTSTEPINUNDOREDO 0x100 #define SC_MOD_CHANGEMARKER 0x200 #define SC_MOD_BEFOREINSERT 0x400 #define SC_MOD_BEFOREDELETE 0x800 #define SC_MULTILINEUNDOREDO 0x1000 #define SC_STARTACTION 0x2000 #define SC_MOD_CHANGEINDICATOR 0x4000 #define SC_MODEVENTMASKALL 0x6FFF #define SCEN_CHANGE 768 #define SCEN_SETFOCUS 512 #define SCEN_KILLFOCUS 256 #define SCK_DOWN 300 #define SCK_UP 301 #define SCK_LEFT 302 #define SCK_RIGHT 303 #define SCK_HOME 304 #define SCK_END 305 #define SCK_PRIOR 306 #define SCK_NEXT 307 #define SCK_DELETE 308 #define SCK_INSERT 309 #define SCK_ESCAPE 7 #define SCK_BACK 8 #define SCK_TAB 9 #define SCK_RETURN 13 #define SCK_ADD 310 #define SCK_SUBTRACT 311 #define SCK_DIVIDE 312 #define SCK_WIN 313 #define SCK_RWIN 314 #define SCK_MENU 315 #define SCMOD_NORM 0 #define SCMOD_SHIFT 1 #define SCMOD_CTRL 2 #define SCMOD_ALT 4 #define SCN_STYLENEEDED 2000 #define SCN_CHARADDED 2001 #define SCN_SAVEPOINTREACHED 2002 #define SCN_SAVEPOINTLEFT 2003 #define SCN_MODIFYATTEMPTRO 2004 #define SCN_KEY 2005 #define SCN_DOUBLECLICK 2006 #define SCN_UPDATEUI 2007 #define SCN_MODIFIED 2008 #define SCN_MACRORECORD 2009 #define SCN_MARGINCLICK 2010 #define SCN_NEEDSHOWN 2011 #define SCN_PAINTED 2013 #define SCN_USERLISTSELECTION 2014 #define SCN_URIDROPPED 2015 #define SCN_DWELLSTART 2016 #define SCN_DWELLEND 2017 #define SCN_ZOOM 2018 #define SCN_HOTSPOTCLICK 2019 #define SCN_HOTSPOTDOUBLECLICK 2020 #define SCN_CALLTIPCLICK 2021 #define SCN_AUTOCSELECTION 2022 #define SCN_INDICATORCLICK 2023 #define SCN_INDICATORRELEASE 2024 //--Autogenerated -- end of section automatically generated from Scintilla.iface // These structures are defined to be exactly the same shape as the Win32 // CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. // So older code that treats Scintilla as a RichEdit will work. #ifdef SCI_NAMESPACE namespace Scintilla { #endif struct CharacterRange { long cpMin; long cpMax; }; struct TextRange { struct CharacterRange chrg; char *lpstrText; }; struct TextToFind { struct CharacterRange chrg; char *lpstrText; struct CharacterRange chrgText; }; #ifdef PLATFORM_H // This structure is used in printing and requires some of the graphics types // from Platform.h. Not needed by most client code. struct RangeToFormat { SurfaceID hdc; SurfaceID hdcTarget; PRectangle rc; PRectangle rcPage; CharacterRange chrg; }; #endif struct NotifyHeader { // Compatible with Windows NMHDR. // hwndFrom is really an environment specific window handle or pointer // but most clients of Scintilla.h do not have this type visible. void *hwndFrom; uptr_t idFrom; unsigned int code; }; struct SCNotification { struct NotifyHeader nmhdr; int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND int ch; // SCN_CHARADDED, SCN_KEY int modifiers; // SCN_KEY int modificationType; // SCN_MODIFIED const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION int length; // SCN_MODIFIED int linesAdded; // SCN_MODIFIED int message; // SCN_MACRORECORD uptr_t wParam; // SCN_MACRORECORD sptr_t lParam; // SCN_MACRORECORD int line; // SCN_MODIFIED int foldLevelNow; // SCN_MODIFIED int foldLevelPrev; // SCN_MODIFIED int margin; // SCN_MARGINCLICK int listType; // SCN_USERLISTSELECTION int x; // SCN_DWELLSTART, SCN_DWELLEND int y; // SCN_DWELLSTART, SCN_DWELLEND }; #ifdef SCI_NAMESPACE } #endif // Deprecation section listing all API features that are deprecated and will // will be removed completely in a future version. // To enable these features define INCLUDE_DEPRECATED_FEATURES #ifdef INCLUDE_DEPRECATED_FEATURES #define SCI_SETCARETPOLICY 2369 #define CARET_CENTER 0x02 #define CARET_XEVEN 0x08 #define CARET_XJUMPS 0x10 #define SCN_POSCHANGED 2012 #define SCN_CHECKBRACE 2007 #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/include/Scintilla.iface0000644000175000001440000027477411407213302023717 0ustar subzerousers## First line may be used for shbang ## This file defines the interface to Scintilla ## Copyright 2000-2003 by Neil Hodgson ## The License.txt file describes the conditions under which this software may be distributed. ## A line starting with ## is a pure comment and should be stripped by readers. ## A line starting with #! is for future shbang use ## A line starting with # followed by a space is a documentation comment and refers ## to the next feature definition. ## Each feature is defined by a line starting with fun, get, set, val or evt. ## cat -> start a category ## fun -> a function ## get -> a property get function ## set -> a property set function ## val -> definition of a constant ## evt -> an event ## enu -> associate an enumeration with a set of vals with a prefix ## lex -> associate a lexer with the lexical classes it produces ## ## All other feature names should be ignored. They may be defined in the future. ## A property may have a set function, a get function or both. Each will have ## "Get" or "Set" in their names and the corresponding name will have the obvious switch. ## A property may be subscripted, in which case the first parameter is the subscript. ## fun, get, and set features have a strict syntax: ## [=,) ## where stands for white space. ## param may be empty (null value) or is [=] ## Additional white space is allowed between elements. ## The syntax for evt is [=[,]*]) ## Feature names that contain an underscore are defined by Windows, so in these ## cases, using the Windows definition is preferred where available. ## The feature numbers are stable so features will not be renumbered. ## Features may be removed but they will go through a period of deprecation ## before removal which is signalled by moving them into the Deprecated category. ## ## enu has the syntax enu=[]* where all the val ## features in this file starting with a given are considered part of the ## enumeration. ## ## lex has the syntax lex=[]* ## where name is a reasonably capitalised (Python, XML) identifier or UI name, ## lexerVal is the val used to specify the lexer, and the list of prefixes is similar ## to enu. The name may not be the same as that used within the lexer so the lexerVal ## should be used to tie these entities together. ## Types: ## void ## int ## bool -> integer, 1=true, 0=false ## position -> integer position in a document ## colour -> colour integer containing red, green and blue bytes. ## string -> pointer to const character ## stringresult -> pointer to character, NULL-> return size of result ## cells -> pointer to array of cells, each cell containing a style byte and character byte ## textrange -> range of a min and a max position with an output string ## findtext -> searchrange, text -> foundposition ## keymod -> integer containing key in low half and modifiers in high half ## formatrange ## Types no longer used: ## findtextex -> searchrange ## charrange -> range of a min and a max position ## charrangeresult -> like charrange, but output param ## countedstring ## point -> x,y ## pointresult -> like point, but output param ## rectangle -> left,top,right,bottom ## Client code should ignore definitions containing types it does not understand, except ## for possibly #defining the constants ## Line numbers and positions start at 0. ## String arguments may contain NUL ('\0') characters where the calls provide a length ## argument and retrieve NUL characters. All retrieved strings except for those retrieved ## by GetLine also have a NUL appended but client code should calculate the size that ## will be returned rather than relying upon the NUL whenever possible. Allow for the ## extra NUL character when allocating buffers. The size to allocate for a stringresult ## can be determined by calling with a NULL (0) pointer. cat Basics ################################################ ## For Scintilla.h val INVALID_POSITION=-1 # Define start of Scintilla messages to be greater than all Windows edit (EM_*) messages # as many EM_ messages can be used although that use is deprecated. val SCI_START=2000 val SCI_OPTIONAL_START=3000 val SCI_LEXER_START=4000 # Add text to the document at current position. fun void AddText=2001(int length, string text) # Add array of cells to document. fun void AddStyledText=2002(int length, cells c) # Insert string at a position. fun void InsertText=2003(position pos, string text) # Delete all text in the document. fun void ClearAll=2004(,) # Set all style bytes to 0, remove all folding information. fun void ClearDocumentStyle=2005(,) # Returns the number of characters in the document. get int GetLength=2006(,) # Returns the character byte at the position. get int GetCharAt=2007(position pos,) # Returns the position of the caret. get position GetCurrentPos=2008(,) # Returns the position of the opposite end of the selection to the caret. get position GetAnchor=2009(,) # Returns the style byte at the position. get int GetStyleAt=2010(position pos,) # Redoes the next action on the undo history. fun void Redo=2011(,) # Choose between collecting actions into the undo # history and discarding them. set void SetUndoCollection=2012(bool collectUndo,) # Select all the text in the document. fun void SelectAll=2013(,) # Remember the current position in the undo history as the position # at which the document was saved. fun void SetSavePoint=2014(,) # Retrieve a buffer of cells. # Returns the number of bytes in the buffer not including terminating NULs. fun int GetStyledText=2015(, textrange tr) # Are there any redoable actions in the undo history? fun bool CanRedo=2016(,) # Retrieve the line number at which a particular marker is located. fun int MarkerLineFromHandle=2017(int handle,) # Delete a marker. fun void MarkerDeleteHandle=2018(int handle,) # Is undo history being collected? get bool GetUndoCollection=2019(,) enu WhiteSpace=SCWS_ val SCWS_INVISIBLE=0 val SCWS_VISIBLEALWAYS=1 val SCWS_VISIBLEAFTERINDENT=2 # Are white space characters currently visible? # Returns one of SCWS_* constants. get int GetViewWS=2020(,) # Make white space characters invisible, always visible or visible outside indentation. set void SetViewWS=2021(int viewWS,) # Find the position from a point within the window. fun position PositionFromPoint=2022(int x, int y) # Find the position from a point within the window but return # INVALID_POSITION if not close to text. fun position PositionFromPointClose=2023(int x, int y) # Set caret to start of a line and ensure it is visible. fun void GotoLine=2024(int line,) # Set caret to a position and ensure it is visible. fun void GotoPos=2025(position pos,) # Set the selection anchor to a position. The anchor is the opposite # end of the selection from the caret. set void SetAnchor=2026(position posAnchor,) # Retrieve the text of the line containing the caret. # Returns the index of the caret on the line. fun int GetCurLine=2027(int length, stringresult text) # Retrieve the position of the last correctly styled character. get position GetEndStyled=2028(,) enu EndOfLine=SC_EOL_ val SC_EOL_CRLF=0 val SC_EOL_CR=1 val SC_EOL_LF=2 # Convert all line endings in the document to one mode. fun void ConvertEOLs=2029(int eolMode,) # Retrieve the current end of line mode - one of CRLF, CR, or LF. get int GetEOLMode=2030(,) # Set the current end of line mode. set void SetEOLMode=2031(int eolMode,) # Set the current styling position to pos and the styling mask to mask. # The styling mask can be used to protect some bits in each styling byte from modification. fun void StartStyling=2032(position pos, int mask) # Change style from current styling position for length characters to a style # and move the current styling position to after this newly styled segment. fun void SetStyling=2033(int length, int style) # Is drawing done first into a buffer or direct to the screen? get bool GetBufferedDraw=2034(,) # If drawing is buffered then each line of text is drawn into a bitmap buffer # before drawing it to the screen to avoid flicker. set void SetBufferedDraw=2035(bool buffered,) # Change the visible size of a tab to be a multiple of the width of a space character. set void SetTabWidth=2036(int tabWidth,) # Retrieve the visible size of a tab. get int GetTabWidth=2121(,) # The SC_CP_UTF8 value can be used to enter Unicode mode. # This is the same value as CP_UTF8 in Windows val SC_CP_UTF8=65001 # The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+. val SC_CP_DBCS=1 # Set the code page used to interpret the bytes of the document as characters. # The SC_CP_UTF8 value can be used to enter Unicode mode. set void SetCodePage=2037(int codePage,) # In palette mode, Scintilla uses the environment's palette calls to display # more colours. This may lead to ugly displays. set void SetUsePalette=2039(bool usePalette,) enu MarkerSymbol=SC_MARK_ val MARKER_MAX=31 val SC_MARK_CIRCLE=0 val SC_MARK_ROUNDRECT=1 val SC_MARK_ARROW=2 val SC_MARK_SMALLRECT=3 val SC_MARK_SHORTARROW=4 val SC_MARK_EMPTY=5 val SC_MARK_ARROWDOWN=6 val SC_MARK_MINUS=7 val SC_MARK_PLUS=8 # Shapes used for outlining column. val SC_MARK_VLINE=9 val SC_MARK_LCORNER=10 val SC_MARK_TCORNER=11 val SC_MARK_BOXPLUS=12 val SC_MARK_BOXPLUSCONNECTED=13 val SC_MARK_BOXMINUS=14 val SC_MARK_BOXMINUSCONNECTED=15 val SC_MARK_LCORNERCURVE=16 val SC_MARK_TCORNERCURVE=17 val SC_MARK_CIRCLEPLUS=18 val SC_MARK_CIRCLEPLUSCONNECTED=19 val SC_MARK_CIRCLEMINUS=20 val SC_MARK_CIRCLEMINUSCONNECTED=21 # Invisible mark that only sets the line background color. val SC_MARK_BACKGROUND=22 val SC_MARK_DOTDOTDOT=23 val SC_MARK_ARROWS=24 val SC_MARK_PIXMAP=25 val SC_MARK_FULLRECT=26 val SC_MARK_CHARACTER=10000 enu MarkerOutline=SC_MARKNUM_ # Markers used for outlining column. val SC_MARKNUM_FOLDEREND=25 val SC_MARKNUM_FOLDEROPENMID=26 val SC_MARKNUM_FOLDERMIDTAIL=27 val SC_MARKNUM_FOLDERTAIL=28 val SC_MARKNUM_FOLDERSUB=29 val SC_MARKNUM_FOLDER=30 val SC_MARKNUM_FOLDEROPEN=31 val SC_MASK_FOLDERS=0xFE000000 # Set the symbol used for a particular marker number. fun void MarkerDefine=2040(int markerNumber, int markerSymbol) # Set the foreground colour used for a particular marker number. fun void MarkerSetFore=2041(int markerNumber, colour fore) # Set the background colour used for a particular marker number. fun void MarkerSetBack=2042(int markerNumber, colour back) # Add a marker to a line, returning an ID which can be used to find or delete the marker. fun int MarkerAdd=2043(int line, int markerNumber) # Delete a marker from a line. fun void MarkerDelete=2044(int line, int markerNumber) # Delete all markers with a particular number from all lines. fun void MarkerDeleteAll=2045(int markerNumber,) # Get a bit mask of all the markers set on a line. fun int MarkerGet=2046(int line,) # Find the next line after lineStart that includes a marker in mask. fun int MarkerNext=2047(int lineStart, int markerMask) # Find the previous line before lineStart that includes a marker in mask. fun int MarkerPrevious=2048(int lineStart, int markerMask) # Define a marker from a pixmap. fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap) # Add a set of markers to a line. fun void MarkerAddSet=2466(int line, int set) # Set the alpha used for a marker that is drawn in the text area, not the margin. fun void MarkerSetAlpha=2476(int markerNumber, int alpha) enu MarginType=SC_MARGIN_ val SC_MARGIN_SYMBOL=0 val SC_MARGIN_NUMBER=1 val SC_MARGIN_BACK=2 val SC_MARGIN_FORE=3 # Set a margin to be either numeric or symbolic. set void SetMarginTypeN=2240(int margin, int marginType) # Retrieve the type of a margin. get int GetMarginTypeN=2241(int margin,) # Set the width of a margin to a width expressed in pixels. set void SetMarginWidthN=2242(int margin, int pixelWidth) # Retrieve the width of a margin in pixels. get int GetMarginWidthN=2243(int margin,) # Set a mask that determines which markers are displayed in a margin. set void SetMarginMaskN=2244(int margin, int mask) # Retrieve the marker mask of a margin. get int GetMarginMaskN=2245(int margin,) # Make a margin sensitive or insensitive to mouse clicks. set void SetMarginSensitiveN=2246(int margin, bool sensitive) # Retrieve the mouse click sensitivity of a margin. get bool GetMarginSensitiveN=2247(int margin,) # Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles. # Style 39 is for future use. enu StylesCommon=STYLE_ val STYLE_DEFAULT=32 val STYLE_LINENUMBER=33 val STYLE_BRACELIGHT=34 val STYLE_BRACEBAD=35 val STYLE_CONTROLCHAR=36 val STYLE_INDENTGUIDE=37 val STYLE_CALLTIP=38 val STYLE_LASTPREDEFINED=39 val STYLE_MAX=127 # Character set identifiers are used in StyleSetCharacterSet. # The values are the same as the Windows *_CHARSET values. enu CharacterSet=SC_CHARSET_ val SC_CHARSET_ANSI=0 val SC_CHARSET_DEFAULT=1 val SC_CHARSET_BALTIC=186 val SC_CHARSET_CHINESEBIG5=136 val SC_CHARSET_EASTEUROPE=238 val SC_CHARSET_GB2312=134 val SC_CHARSET_GREEK=161 val SC_CHARSET_HANGUL=129 val SC_CHARSET_MAC=77 val SC_CHARSET_OEM=255 val SC_CHARSET_RUSSIAN=204 val SC_CHARSET_CYRILLIC=1251 val SC_CHARSET_SHIFTJIS=128 val SC_CHARSET_SYMBOL=2 val SC_CHARSET_TURKISH=162 val SC_CHARSET_JOHAB=130 val SC_CHARSET_HEBREW=177 val SC_CHARSET_ARABIC=178 val SC_CHARSET_VIETNAMESE=163 val SC_CHARSET_THAI=222 val SC_CHARSET_8859_15=1000 # Clear all the styles and make equivalent to the global default style. set void StyleClearAll=2050(,) # Set the foreground colour of a style. set void StyleSetFore=2051(int style, colour fore) # Set the background colour of a style. set void StyleSetBack=2052(int style, colour back) # Set a style to be bold or not. set void StyleSetBold=2053(int style, bool bold) # Set a style to be italic or not. set void StyleSetItalic=2054(int style, bool italic) # Set the size of characters of a style. set void StyleSetSize=2055(int style, int sizePoints) # Set the font of a style. set void StyleSetFont=2056(int style, string fontName) # Set a style to have its end of line filled or not. set void StyleSetEOLFilled=2057(int style, bool filled) # Reset the default style to its state at startup fun void StyleResetDefault=2058(,) # Set a style to be underlined or not. set void StyleSetUnderline=2059(int style, bool underline) enu CaseVisible=SC_CASE_ val SC_CASE_MIXED=0 val SC_CASE_UPPER=1 val SC_CASE_LOWER=2 # Get the foreground colour of a style. get colour StyleGetFore=2481(int style,) # Get the background colour of a style. get colour StyleGetBack=2482(int style,) # Get is a style bold or not. get bool StyleGetBold=2483(int style,) # Get is a style italic or not. get bool StyleGetItalic=2484(int style,) # Get the size of characters of a style. get int StyleGetSize=2485(int style,) # Get the font of a style. # Returns the length of the fontName fun int StyleGetFont=2486(int style, stringresult fontName) # Get is a style to have its end of line filled or not. get bool StyleGetEOLFilled=2487(int style,) # Get is a style underlined or not. get bool StyleGetUnderline=2488(int style,) # Get is a style mixed case, or to force upper or lower case. get int StyleGetCase=2489(int style,) # Get the character get of the font in a style. get int StyleGetCharacterSet=2490(int style,) # Get is a style visible or not. get bool StyleGetVisible=2491(int style,) # Get is a style changeable or not (read only). # Experimental feature, currently buggy. get bool StyleGetChangeable=2492(int style,) # Get is a style a hotspot or not. get bool StyleGetHotSpot=2493(int style,) # Set a style to be mixed case, or to force upper or lower case. set void StyleSetCase=2060(int style, int caseForce) # Set the character set of the font in a style. set void StyleSetCharacterSet=2066(int style, int characterSet) # Set a style to be a hotspot or not. set void StyleSetHotSpot=2409(int style, bool hotspot) # Set the foreground colour of the selection and whether to use this setting. fun void SetSelFore=2067(bool useSetting, colour fore) # Set the background colour of the selection and whether to use this setting. fun void SetSelBack=2068(bool useSetting, colour back) # Get the alpha of the selection. get int GetSelAlpha=2477(,) # Set the alpha of the selection. set void SetSelAlpha=2478(int alpha,) # Is the selection end of line filled? get bool GetSelEOLFilled=2479(,) # Set the selection to have its end of line filled or not. set void SetSelEOLFilled=2480(bool filled,) # Set the foreground colour of the caret. set void SetCaretFore=2069(colour fore,) # When key+modifier combination km is pressed perform msg. fun void AssignCmdKey=2070(keymod km, int msg) # When key+modifier combination km is pressed do nothing. fun void ClearCmdKey=2071(keymod km,) # Drop all key mappings. fun void ClearAllCmdKeys=2072(,) # Set the styles for a segment of the document. fun void SetStylingEx=2073(int length, string styles) # Set a style to be visible or not. set void StyleSetVisible=2074(int style, bool visible) # Get the time in milliseconds that the caret is on and off. get int GetCaretPeriod=2075(,) # Get the time in milliseconds that the caret is on and off. 0 = steady on. set void SetCaretPeriod=2076(int periodMilliseconds,) # Set the set of characters making up words for when moving or selecting by word. # First sets deaults like SetCharsDefault. set void SetWordChars=2077(, string characters) # Start a sequence of actions that is undone and redone as a unit. # May be nested. fun void BeginUndoAction=2078(,) # End a sequence of actions that is undone and redone as a unit. fun void EndUndoAction=2079(,) # Indicator style enumeration and some constants enu IndicatorStyle=INDIC_ val INDIC_PLAIN=0 val INDIC_SQUIGGLE=1 val INDIC_TT=2 val INDIC_DIAGONAL=3 val INDIC_STRIKE=4 val INDIC_HIDDEN=5 val INDIC_BOX=6 val INDIC_ROUNDBOX=7 val INDIC_MAX=31 val INDIC_CONTAINER=8 val INDIC0_MASK=0x20 val INDIC1_MASK=0x40 val INDIC2_MASK=0x80 val INDICS_MASK=0xE0 # Set an indicator to plain, squiggle or TT. set void IndicSetStyle=2080(int indic, int style) # Retrieve the style of an indicator. get int IndicGetStyle=2081(int indic,) # Set the foreground colour of an indicator. set void IndicSetFore=2082(int indic, colour fore) # Retrieve the foreground colour of an indicator. get colour IndicGetFore=2083(int indic,) # Set an indicator to draw under text or over(default). set void IndicSetUnder=2510(int indic, bool under) # Retrieve whether indicator drawn under or over text. get bool IndicGetUnder=2511(int indic,) # Set the foreground colour of all whitespace and whether to use this setting. fun void SetWhitespaceFore=2084(bool useSetting, colour fore) # Set the background colour of all whitespace and whether to use this setting. fun void SetWhitespaceBack=2085(bool useSetting, colour back) # Divide each styling byte into lexical class bits (default: 5) and indicator # bits (default: 3). If a lexer requires more than 32 lexical states, then this # is used to expand the possible states. set void SetStyleBits=2090(int bits,) # Retrieve number of bits in style bytes used to hold the lexical state. get int GetStyleBits=2091(,) # Used to hold extra styling information for each line. set void SetLineState=2092(int line, int state) # Retrieve the extra styling information for a line. get int GetLineState=2093(int line,) # Retrieve the last line number that has line state. get int GetMaxLineState=2094(,) # Is the background of the line containing the caret in a different colour? get bool GetCaretLineVisible=2095(,) # Display the background of the line containing the caret in a different colour. set void SetCaretLineVisible=2096(bool show,) # Get the colour of the background of the line containing the caret. get colour GetCaretLineBack=2097(,) # Set the colour of the background of the line containing the caret. set void SetCaretLineBack=2098(colour back,) # Set a style to be changeable or not (read only). # Experimental feature, currently buggy. set void StyleSetChangeable=2099(int style, bool changeable) # Display a auto-completion list. # The lenEntered parameter indicates how many characters before # the caret should be used to provide context. fun void AutoCShow=2100(int lenEntered, string itemList) # Remove the auto-completion list from the screen. fun void AutoCCancel=2101(,) # Is there an auto-completion list visible? fun bool AutoCActive=2102(,) # Retrieve the position of the caret when the auto-completion list was displayed. fun position AutoCPosStart=2103(,) # User has selected an item so remove the list and insert the selection. fun void AutoCComplete=2104(,) # Define a set of character that when typed cancel the auto-completion list. fun void AutoCStops=2105(, string characterSet) # Change the separator character in the string setting up an auto-completion list. # Default is space but can be changed if items contain space. set void AutoCSetSeparator=2106(int separatorCharacter,) # Retrieve the auto-completion list separator character. get int AutoCGetSeparator=2107(,) # Select the item in the auto-completion list that starts with a string. fun void AutoCSelect=2108(, string text) # Should the auto-completion list be cancelled if the user backspaces to a # position before where the box was created. set void AutoCSetCancelAtStart=2110(bool cancel,) # Retrieve whether auto-completion cancelled by backspacing before start. get bool AutoCGetCancelAtStart=2111(,) # Define a set of characters that when typed will cause the autocompletion to # choose the selected item. set void AutoCSetFillUps=2112(, string characterSet) # Should a single item auto-completion list automatically choose the item. set void AutoCSetChooseSingle=2113(bool chooseSingle,) # Retrieve whether a single item auto-completion list automatically choose the item. get bool AutoCGetChooseSingle=2114(,) # Set whether case is significant when performing auto-completion searches. set void AutoCSetIgnoreCase=2115(bool ignoreCase,) # Retrieve state of ignore case flag. get bool AutoCGetIgnoreCase=2116(,) # Display a list of strings and send notification when user chooses one. fun void UserListShow=2117(int listType, string itemList) # Set whether or not autocompletion is hidden automatically when nothing matches. set void AutoCSetAutoHide=2118(bool autoHide,) # Retrieve whether or not autocompletion is hidden automatically when nothing matches. get bool AutoCGetAutoHide=2119(,) # Set whether or not autocompletion deletes any word characters # after the inserted text upon completion. set void AutoCSetDropRestOfWord=2270(bool dropRestOfWord,) # Retrieve whether or not autocompletion deletes any word characters # after the inserted text upon completion. get bool AutoCGetDropRestOfWord=2271(,) # Register an XPM image for use in autocompletion lists. fun void RegisterImage=2405(int type, string xpmData) # Clear all the registered XPM images. fun void ClearRegisteredImages=2408(,) # Retrieve the auto-completion list type-separator character. get int AutoCGetTypeSeparator=2285(,) # Change the type-separator character in the string setting up an auto-completion list. # Default is '?' but can be changed if items contain '?'. set void AutoCSetTypeSeparator=2286(int separatorCharacter,) # Set the maximum width, in characters, of auto-completion and user lists. # Set to 0 to autosize to fit longest item, which is the default. set void AutoCSetMaxWidth=2208(int characterCount,) # Get the maximum width, in characters, of auto-completion and user lists. get int AutoCGetMaxWidth=2209(,) # Set the maximum height, in rows, of auto-completion and user lists. # The default is 5 rows. set void AutoCSetMaxHeight=2210(int rowCount,) # Set the maximum height, in rows, of auto-completion and user lists. get int AutoCGetMaxHeight=2211(,) # Set the number of spaces used for one level of indentation. set void SetIndent=2122(int indentSize,) # Retrieve indentation size. get int GetIndent=2123(,) # Indentation will only use space characters if useTabs is false, otherwise # it will use a combination of tabs and spaces. set void SetUseTabs=2124(bool useTabs,) # Retrieve whether tabs will be used in indentation. get bool GetUseTabs=2125(,) # Change the indentation of a line to a number of columns. set void SetLineIndentation=2126(int line, int indentSize) # Retrieve the number of columns that a line is indented. get int GetLineIndentation=2127(int line,) # Retrieve the position before the first non indentation character on a line. get position GetLineIndentPosition=2128(int line,) # Retrieve the column number of a position, taking tab width into account. get int GetColumn=2129(position pos,) # Show or hide the horizontal scroll bar. set void SetHScrollBar=2130(bool show,) # Is the horizontal scroll bar visible? get bool GetHScrollBar=2131(,) # Show or hide indentation guides. set void SetIndentationGuides=2132(bool show,) # Are the indentation guides visible? get bool GetIndentationGuides=2133(,) # Set the highlighted indentation guide column. # 0 = no highlighted guide. set void SetHighlightGuide=2134(int column,) # Get the highlighted indentation guide column. get int GetHighlightGuide=2135(,) # Get the position after the last visible characters on a line. get int GetLineEndPosition=2136(int line,) # Get the code page used to interpret the bytes of the document as characters. get int GetCodePage=2137(,) # Get the foreground colour of the caret. get colour GetCaretFore=2138(,) # In palette mode? get bool GetUsePalette=2139(,) # In read-only mode? get bool GetReadOnly=2140(,) # Sets the position of the caret. set void SetCurrentPos=2141(position pos,) # Sets the position that starts the selection - this becomes the anchor. set void SetSelectionStart=2142(position pos,) # Returns the position at the start of the selection. get position GetSelectionStart=2143(,) # Sets the position that ends the selection - this becomes the currentPosition. set void SetSelectionEnd=2144(position pos,) # Returns the position at the end of the selection. get position GetSelectionEnd=2145(,) # Sets the print magnification added to the point size of each style for printing. set void SetPrintMagnification=2146(int magnification,) # Returns the print magnification. get int GetPrintMagnification=2147(,) enu PrintOption=SC_PRINT_ # PrintColourMode - use same colours as screen. val SC_PRINT_NORMAL=0 # PrintColourMode - invert the light value of each style for printing. val SC_PRINT_INVERTLIGHT=1 # PrintColourMode - force black text on white background for printing. val SC_PRINT_BLACKONWHITE=2 # PrintColourMode - text stays coloured, but all background is forced to be white for printing. val SC_PRINT_COLOURONWHITE=3 # PrintColourMode - only the default-background is forced to be white for printing. val SC_PRINT_COLOURONWHITEDEFAULTBG=4 # Modify colours when printing for clearer printed text. set void SetPrintColourMode=2148(int mode,) # Returns the print colour mode. get int GetPrintColourMode=2149(,) enu FindOption=SCFIND_ val SCFIND_WHOLEWORD=2 val SCFIND_MATCHCASE=4 val SCFIND_WORDSTART=0x00100000 val SCFIND_REGEXP=0x00200000 val SCFIND_POSIX=0x00400000 # Find some text in the document. fun position FindText=2150(int flags, findtext ft) # On Windows, will draw the document into a display context such as a printer. fun position FormatRange=2151(bool draw, formatrange fr) # Retrieve the display line at the top of the display. get int GetFirstVisibleLine=2152(,) # Retrieve the contents of a line. # Returns the length of the line. fun int GetLine=2153(int line, stringresult text) # Returns the number of lines in the document. There is always at least one. get int GetLineCount=2154(,) # Sets the size in pixels of the left margin. set void SetMarginLeft=2155(, int pixelWidth) # Returns the size in pixels of the left margin. get int GetMarginLeft=2156(,) # Sets the size in pixels of the right margin. set void SetMarginRight=2157(, int pixelWidth) # Returns the size in pixels of the right margin. get int GetMarginRight=2158(,) # Is the document different from when it was last saved? get bool GetModify=2159(,) # Select a range of text. fun void SetSel=2160(position start, position end) # Retrieve the selected text. # Return the length of the text. fun int GetSelText=2161(, stringresult text) # Retrieve a range of text. # Return the length of the text. fun int GetTextRange=2162(, textrange tr) # Draw the selection in normal style or with selection highlighted. fun void HideSelection=2163(bool normal,) # Retrieve the x value of the point in the window where a position is displayed. fun int PointXFromPosition=2164(, position pos) # Retrieve the y value of the point in the window where a position is displayed. fun int PointYFromPosition=2165(, position pos) # Retrieve the line containing a position. fun int LineFromPosition=2166(position pos,) # Retrieve the position at the start of a line. fun position PositionFromLine=2167(int line,) # Scroll horizontally and vertically. fun void LineScroll=2168(int columns, int lines) # Ensure the caret is visible. fun void ScrollCaret=2169(,) # Replace the selected text with the argument text. fun void ReplaceSel=2170(, string text) # Set to read only or read write. set void SetReadOnly=2171(bool readOnly,) # Null operation. fun void Null=2172(,) # Will a paste succeed? fun bool CanPaste=2173(,) # Are there any undoable actions in the undo history? fun bool CanUndo=2174(,) # Delete the undo history. fun void EmptyUndoBuffer=2175(,) # Undo one action in the undo history. fun void Undo=2176(,) # Cut the selection to the clipboard. fun void Cut=2177(,) # Copy the selection to the clipboard. fun void Copy=2178(,) # Paste the contents of the clipboard into the document replacing the selection. fun void Paste=2179(,) # Clear the selection. fun void Clear=2180(,) # Replace the contents of the document with the argument text. fun void SetText=2181(, string text) # Retrieve all the text in the document. # Returns number of characters retrieved. fun int GetText=2182(int length, stringresult text) # Retrieve the number of characters in the document. get int GetTextLength=2183(,) # Retrieve a pointer to a function that processes messages for this Scintilla. get int GetDirectFunction=2184(,) # Retrieve a pointer value to use as the first argument when calling # the function returned by GetDirectFunction. get int GetDirectPointer=2185(,) # Set to overtype (true) or insert mode. set void SetOvertype=2186(bool overtype,) # Returns true if overtype mode is active otherwise false is returned. get bool GetOvertype=2187(,) # Set the width of the insert mode caret. set void SetCaretWidth=2188(int pixelWidth,) # Returns the width of the insert mode caret. get int GetCaretWidth=2189(,) # Sets the position that starts the target which is used for updating the # document without affecting the scroll position. set void SetTargetStart=2190(position pos,) # Get the position that starts the target. get position GetTargetStart=2191(,) # Sets the position that ends the target which is used for updating the # document without affecting the scroll position. set void SetTargetEnd=2192(position pos,) # Get the position that ends the target. get position GetTargetEnd=2193(,) # Replace the target text with the argument text. # Text is counted so it can contain NULs. # Returns the length of the replacement text. fun int ReplaceTarget=2194(int length, string text) # Replace the target text with the argument text after \d processing. # Text is counted so it can contain NULs. # Looks for \d where d is between 1 and 9 and replaces these with the strings # matched in the last search operation which were surrounded by \( and \). # Returns the length of the replacement text including any change # caused by processing the \d patterns. fun int ReplaceTargetRE=2195(int length, string text) # Search for a counted string in the target and set the target to the found # range. Text is counted so it can contain NULs. # Returns length of range or -1 for failure in which case target is not moved. fun int SearchInTarget=2197(int length, string text) # Set the search flags used by SearchInTarget. set void SetSearchFlags=2198(int flags,) # Get the search flags used by SearchInTarget. get int GetSearchFlags=2199(,) # Show a call tip containing a definition near position pos. fun void CallTipShow=2200(position pos, string definition) # Remove the call tip from the screen. fun void CallTipCancel=2201(,) # Is there an active call tip? fun bool CallTipActive=2202(,) # Retrieve the position where the caret was before displaying the call tip. fun position CallTipPosStart=2203(,) # Highlight a segment of the definition. fun void CallTipSetHlt=2204(int start, int end) # Set the background colour for the call tip. set void CallTipSetBack=2205(colour back,) # Set the foreground colour for the call tip. set void CallTipSetFore=2206(colour fore,) # Set the foreground colour for the highlighted part of the call tip. set void CallTipSetForeHlt=2207(colour fore,) # Enable use of STYLE_CALLTIP and set call tip tab size in pixels. set void CallTipUseStyle=2212(int tabSize,) # Find the display line of a document line taking hidden lines into account. fun int VisibleFromDocLine=2220(int line,) # Find the document line of a display line taking hidden lines into account. fun int DocLineFromVisible=2221(int lineDisplay,) # The number of display lines needed to wrap a document line fun int WrapCount=2235(int line,) enu FoldLevel=SC_FOLDLEVEL val SC_FOLDLEVELBASE=0x400 val SC_FOLDLEVELWHITEFLAG=0x1000 val SC_FOLDLEVELHEADERFLAG=0x2000 val SC_FOLDLEVELBOXHEADERFLAG=0x4000 val SC_FOLDLEVELBOXFOOTERFLAG=0x8000 val SC_FOLDLEVELCONTRACTED=0x10000 val SC_FOLDLEVELUNINDENT=0x20000 val SC_FOLDLEVELNUMBERMASK=0x0FFF # Set the fold level of a line. # This encodes an integer level along with flags indicating whether the # line is a header and whether it is effectively white space. set void SetFoldLevel=2222(int line, int level) # Retrieve the fold level of a line. get int GetFoldLevel=2223(int line,) # Find the last child line of a header line. get int GetLastChild=2224(int line, int level) # Find the parent line of a child line. get int GetFoldParent=2225(int line,) # Make a range of lines visible. fun void ShowLines=2226(int lineStart, int lineEnd) # Make a range of lines invisible. fun void HideLines=2227(int lineStart, int lineEnd) # Is a line visible? get bool GetLineVisible=2228(int line,) # Show the children of a header line. set void SetFoldExpanded=2229(int line, bool expanded) # Is a header line expanded? get bool GetFoldExpanded=2230(int line,) # Switch a header line between expanded and contracted. fun void ToggleFold=2231(int line,) # Ensure a particular line is visible by expanding any header line hiding it. fun void EnsureVisible=2232(int line,) enu FoldFlag=SC_FOLDFLAG_ val SC_FOLDFLAG_LINEBEFORE_EXPANDED=0x0002 val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004 val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008 val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010 val SC_FOLDFLAG_LEVELNUMBERS=0x0040 val SC_FOLDFLAG_BOX=0x0001 # Set some style options for folding. fun void SetFoldFlags=2233(int flags,) # Ensure a particular line is visible by expanding any header line hiding it. # Use the currently set visibility policy to determine which range to display. fun void EnsureVisibleEnforcePolicy=2234(int line,) # Sets whether a tab pressed when caret is within indentation indents. set void SetTabIndents=2260(bool tabIndents,) # Does a tab pressed when caret is within indentation indent? get bool GetTabIndents=2261(,) # Sets whether a backspace pressed when caret is within indentation unindents. set void SetBackSpaceUnIndents=2262(bool bsUnIndents,) # Does a backspace pressed when caret is within indentation unindent? get bool GetBackSpaceUnIndents=2263(,) val SC_TIME_FOREVER=10000000 # Sets the time the mouse must sit still to generate a mouse dwell event. set void SetMouseDwellTime=2264(int periodMilliseconds,) # Retrieve the time the mouse must sit still to generate a mouse dwell event. get int GetMouseDwellTime=2265(,) # Get position of start of word. fun int WordStartPosition=2266(position pos, bool onlyWordCharacters) # Get position of end of word. fun int WordEndPosition=2267(position pos, bool onlyWordCharacters) enu Wrap=SC_WRAP_ val SC_WRAP_NONE=0 val SC_WRAP_WORD=1 val SC_WRAP_CHAR=2 # Sets whether text is word wrapped. set void SetWrapMode=2268(int mode,) # Retrieve whether text is word wrapped. get int GetWrapMode=2269(,) enu WrapVisualFlag=SC_WRAPVISUALFLAG_ val SC_WRAPVISUALFLAG_NONE=0x0000 val SC_WRAPVISUALFLAG_END=0x0001 val SC_WRAPVISUALFLAG_START=0x0002 # Set the display mode of visual flags for wrapped lines. set void SetWrapVisualFlags=2460(int wrapVisualFlags,) # Retrive the display mode of visual flags for wrapped lines. get int GetWrapVisualFlags=2461(,) enu WrapVisualLocation=SC_WRAPVISUALFLAGLOC_ val SC_WRAPVISUALFLAGLOC_DEFAULT=0x0000 val SC_WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001 val SC_WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002 # Set the location of visual flags for wrapped lines. set void SetWrapVisualFlagsLocation=2462(int wrapVisualFlagsLocation,) # Retrive the location of visual flags for wrapped lines. get int GetWrapVisualFlagsLocation=2463(,) # Set the start indent for wrapped lines. set void SetWrapStartIndent=2464(int indent,) # Retrive the start indent for wrapped lines. get int GetWrapStartIndent=2465(,) enu LineCache=SC_CACHE_ val SC_CACHE_NONE=0 val SC_CACHE_CARET=1 val SC_CACHE_PAGE=2 val SC_CACHE_DOCUMENT=3 # Sets the degree of caching of layout information. set void SetLayoutCache=2272(int mode,) # Retrieve the degree of caching of layout information. get int GetLayoutCache=2273(,) # Sets the document width assumed for scrolling. set void SetScrollWidth=2274(int pixelWidth,) # Retrieve the document width assumed for scrolling. get int GetScrollWidth=2275(,) # Measure the pixel width of some text in a particular style. # NUL terminated text argument. # Does not handle tab or control characters. fun int TextWidth=2276(int style, string text) # Sets the scroll range so that maximum scroll position has # the last line at the bottom of the view (default). # Setting this to false allows scrolling one page below the last line. set void SetEndAtLastLine=2277(bool endAtLastLine,) # Retrieve whether the maximum scroll position has the last # line at the bottom of the view. get bool GetEndAtLastLine=2278(,) # Retrieve the height of a particular line of text in pixels. fun int TextHeight=2279(int line,) # Show or hide the vertical scroll bar. set void SetVScrollBar=2280(bool show,) # Is the vertical scroll bar visible? get bool GetVScrollBar=2281(,) # Append a string to the end of the document without changing the selection. fun void AppendText=2282(int length, string text) # Is drawing done in two phases with backgrounds drawn before faoregrounds? get bool GetTwoPhaseDraw=2283(,) # In twoPhaseDraw mode, drawing is performed in two phases, first the background # and then the foreground. This avoids chopping off characters that overlap the next run. set void SetTwoPhaseDraw=2284(bool twoPhase,) # Make the target range start and end be the same as the selection range start and end. fun void TargetFromSelection=2287(,) # Join the lines in the target. fun void LinesJoin=2288(,) # Split the lines in the target into lines that are less wide than pixelWidth # where possible. fun void LinesSplit=2289(int pixelWidth,) # Set the colours used as a chequerboard pattern in the fold margin fun void SetFoldMarginColour=2290(bool useSetting, colour back) fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore) ## New messages go here ## Start of key messages # Move caret down one line. fun void LineDown=2300(,) # Move caret down one line extending selection to new caret position. fun void LineDownExtend=2301(,) # Move caret up one line. fun void LineUp=2302(,) # Move caret up one line extending selection to new caret position. fun void LineUpExtend=2303(,) # Move caret left one character. fun void CharLeft=2304(,) # Move caret left one character extending selection to new caret position. fun void CharLeftExtend=2305(,) # Move caret right one character. fun void CharRight=2306(,) # Move caret right one character extending selection to new caret position. fun void CharRightExtend=2307(,) # Move caret left one word. fun void WordLeft=2308(,) # Move caret left one word extending selection to new caret position. fun void WordLeftExtend=2309(,) # Move caret right one word. fun void WordRight=2310(,) # Move caret right one word extending selection to new caret position. fun void WordRightExtend=2311(,) # Move caret to first position on line. fun void Home=2312(,) # Move caret to first position on line extending selection to new caret position. fun void HomeExtend=2313(,) # Move caret to last position on line. fun void LineEnd=2314(,) # Move caret to last position on line extending selection to new caret position. fun void LineEndExtend=2315(,) # Move caret to first position in document. fun void DocumentStart=2316(,) # Move caret to first position in document extending selection to new caret position. fun void DocumentStartExtend=2317(,) # Move caret to last position in document. fun void DocumentEnd=2318(,) # Move caret to last position in document extending selection to new caret position. fun void DocumentEndExtend=2319(,) # Move caret one page up. fun void PageUp=2320(,) # Move caret one page up extending selection to new caret position. fun void PageUpExtend=2321(,) # Move caret one page down. fun void PageDown=2322(,) # Move caret one page down extending selection to new caret position. fun void PageDownExtend=2323(,) # Switch from insert to overtype mode or the reverse. fun void EditToggleOvertype=2324(,) # Cancel any modes such as call tip or auto-completion list display. fun void Cancel=2325(,) # Delete the selection or if no selection, the character before the caret. fun void DeleteBack=2326(,) # If selection is empty or all on one line replace the selection with a tab character. # If more than one line selected, indent the lines. fun void Tab=2327(,) # Dedent the selected lines. fun void BackTab=2328(,) # Insert a new line, may use a CRLF, CR or LF depending on EOL mode. fun void NewLine=2329(,) # Insert a Form Feed character. fun void FormFeed=2330(,) # Move caret to before first visible character on line. # If already there move to first character on line. fun void VCHome=2331(,) # Like VCHome but extending selection to new caret position. fun void VCHomeExtend=2332(,) # Magnify the displayed text by increasing the sizes by 1 point. fun void ZoomIn=2333(,) # Make the displayed text smaller by decreasing the sizes by 1 point. fun void ZoomOut=2334(,) # Delete the word to the left of the caret. fun void DelWordLeft=2335(,) # Delete the word to the right of the caret. fun void DelWordRight=2336(,) # Cut the line containing the caret. fun void LineCut=2337(,) # Delete the line containing the caret. fun void LineDelete=2338(,) # Switch the current line with the previous. fun void LineTranspose=2339(,) # Duplicate the current line. fun void LineDuplicate=2404(,) # Transform the selection to lower case. fun void LowerCase=2340(,) # Transform the selection to upper case. fun void UpperCase=2341(,) # Scroll the document down, keeping the caret visible. fun void LineScrollDown=2342(,) # Scroll the document up, keeping the caret visible. fun void LineScrollUp=2343(,) # Delete the selection or if no selection, the character before the caret. # Will not delete the character before at the start of a line. fun void DeleteBackNotLine=2344(,) # Move caret to first position on display line. fun void HomeDisplay=2345(,) # Move caret to first position on display line extending selection to # new caret position. fun void HomeDisplayExtend=2346(,) # Move caret to last position on display line. fun void LineEndDisplay=2347(,) # Move caret to last position on display line extending selection to new # caret position. fun void LineEndDisplayExtend=2348(,) # These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? # except they behave differently when word-wrap is enabled: # They go first to the start / end of the display line, like (Home|LineEnd)Display # The difference is that, the cursor is already at the point, it goes on to the start # or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. fun void HomeWrap=2349(,) fun void HomeWrapExtend=2450(,) fun void LineEndWrap=2451(,) fun void LineEndWrapExtend=2452(,) fun void VCHomeWrap=2453(,) fun void VCHomeWrapExtend=2454(,) # Copy the line containing the caret. fun void LineCopy=2455(,) # Move the caret inside current view if it's not there already. fun void MoveCaretInsideView=2401(,) # How many characters are on a line, including end of line characters? fun int LineLength=2350(int line,) # Highlight the characters at two positions. fun void BraceHighlight=2351(position pos1, position pos2) # Highlight the character at a position indicating there is no matching brace. fun void BraceBadLight=2352(position pos,) # Find the position of a matching brace or INVALID_POSITION if no match. fun position BraceMatch=2353(position pos,) # Are the end of line characters visible? get bool GetViewEOL=2355(,) # Make the end of line characters visible or invisible. set void SetViewEOL=2356(bool visible,) # Retrieve a pointer to the document object. get int GetDocPointer=2357(,) # Change the document object used. set void SetDocPointer=2358(, int pointer) # Set which document modification events are sent to the container. set void SetModEventMask=2359(int mask,) enu EdgeVisualStyle=EDGE_ val EDGE_NONE=0 val EDGE_LINE=1 val EDGE_BACKGROUND=2 # Retrieve the column number which text should be kept within. get int GetEdgeColumn=2360(,) # Set the column number of the edge. # If text goes past the edge then it is highlighted. set void SetEdgeColumn=2361(int column,) # Retrieve the edge highlight mode. get int GetEdgeMode=2362(,) # The edge may be displayed by a line (EDGE_LINE) or by highlighting text that # goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). set void SetEdgeMode=2363(int mode,) # Retrieve the colour used in edge indication. get colour GetEdgeColour=2364(,) # Change the colour used in edge indication. set void SetEdgeColour=2365(colour edgeColour,) # Sets the current caret position to be the search anchor. fun void SearchAnchor=2366(,) # Find some text starting at the search anchor. # Does not ensure the selection is visible. fun int SearchNext=2367(int flags, string text) # Find some text starting at the search anchor and moving backwards. # Does not ensure the selection is visible. fun int SearchPrev=2368(int flags, string text) # Retrieves the number of lines completely visible. get int LinesOnScreen=2370(,) # Set whether a pop up menu is displayed automatically when the user presses # the wrong mouse button. fun void UsePopUp=2371(bool allowPopUp,) # Is the selection rectangular? The alternative is the more common stream selection. get bool SelectionIsRectangle=2372(,) # Set the zoom level. This number of points is added to the size of all fonts. # It may be positive to magnify or negative to reduce. set void SetZoom=2373(int zoom,) # Retrieve the zoom level. get int GetZoom=2374(,) # Create a new document object. # Starts with reference count of 1 and not selected into editor. fun int CreateDocument=2375(,) # Extend life of document. fun void AddRefDocument=2376(, int doc) # Release a reference to the document, deleting document if it fades to black. fun void ReleaseDocument=2377(, int doc) # Get which document modification events are sent to the container. get int GetModEventMask=2378(,) # Change internal focus flag. set void SetFocus=2380(bool focus,) # Get internal focus flag. get bool GetFocus=2381(,) # Change error status - 0 = OK. set void SetStatus=2382(int statusCode,) # Get error status. get int GetStatus=2383(,) # Set whether the mouse is captured when its button is pressed. set void SetMouseDownCaptures=2384(bool captures,) # Get whether mouse gets captured. get bool GetMouseDownCaptures=2385(,) enu CursorShape=SC_CURSOR val SC_CURSORNORMAL=-1 val SC_CURSORWAIT=4 # Sets the cursor to one of the SC_CURSOR* values. set void SetCursor=2386(int cursorType,) # Get cursor type. get int GetCursor=2387(,) # Change the way control characters are displayed: # If symbol is < 32, keep the drawn way, else, use the given character. set void SetControlCharSymbol=2388(int symbol,) # Get the way control characters are displayed. get int GetControlCharSymbol=2389(,) # Move to the previous change in capitalisation. fun void WordPartLeft=2390(,) # Move to the previous change in capitalisation extending selection # to new caret position. fun void WordPartLeftExtend=2391(,) # Move to the change next in capitalisation. fun void WordPartRight=2392(,) # Move to the next change in capitalisation extending selection # to new caret position. fun void WordPartRightExtend=2393(,) # Constants for use with SetVisiblePolicy, similar to SetCaretPolicy. val VISIBLE_SLOP=0x01 val VISIBLE_STRICT=0x04 # Set the way the display area is determined when a particular line # is to be moved to by Find, FindNext, GotoLine, etc. fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop) # Delete back from the current position to the start of the line. fun void DelLineLeft=2395(,) # Delete forwards from the current position to the end of the line. fun void DelLineRight=2396(,) # Get and Set the xOffset (ie, horizonal scroll position). set void SetXOffset=2397(int newOffset,) get int GetXOffset=2398(,) # Set the last x chosen value to be the caret x position. fun void ChooseCaretX=2399(,) # Set the focus to this Scintilla widget. fun void GrabFocus=2400(,) enu CaretPolicy = CARET_ # Caret policy, used by SetXCaretPolicy and SetYCaretPolicy. # If CARET_SLOP is set, we can define a slop value: caretSlop. # This value defines an unwanted zone (UZ) where the caret is... unwanted. # This zone is defined as a number of pixels near the vertical margins, # and as a number of lines near the horizontal margins. # By keeping the caret away from the edges, it is seen within its context, # so it is likely that the identifier that the caret is on can be completely seen, # and that the current line is seen with some of the lines following it which are # often dependent on that line. val CARET_SLOP=0x01 # If CARET_STRICT is set, the policy is enforced... strictly. # The caret is centred on the display if slop is not set, # and cannot go in the UZ if slop is set. val CARET_STRICT=0x04 # If CARET_JUMPS is set, the display is moved more energetically # so the caret can move in the same direction longer before the policy is applied again. val CARET_JUMPS=0x10 # If CARET_EVEN is not set, instead of having symmetrical UZs, # the left and bottom UZs are extended up to right and top UZs respectively. # This way, we favour the displaying of useful information: the begining of lines, # where most code reside, and the lines after the caret, eg. the body of a function. val CARET_EVEN=0x08 # Set the way the caret is kept visible when going sideway. # The exclusion zone is given in pixels. fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop) # Set the way the line the caret is on is kept visible. # The exclusion zone is given in lines. fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop) # Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). set void SetPrintWrapMode=2406(int mode,) # Is printing line wrapped? get int GetPrintWrapMode=2407(,) # Set a fore colour for active hotspots. set void SetHotspotActiveFore=2410(bool useSetting, colour fore) # Get the fore colour for active hotspots. get colour GetHotspotActiveFore=2494(,) # Set a back colour for active hotspots. set void SetHotspotActiveBack=2411(bool useSetting, colour back) # Get the back colour for active hotspots. get colour GetHotspotActiveBack=2495(,) # Enable / Disable underlining active hotspots. set void SetHotspotActiveUnderline=2412(bool underline,) # Get whether underlining for active hotspots. get bool GetHotspotActiveUnderline=2496(,) # Limit hotspots to single line so hotspots on two lines don't merge. set void SetHotspotSingleLine=2421(bool singleLine,) # Get the HotspotSingleLine property get bool GetHotspotSingleLine=2497(,) # Move caret between paragraphs (delimited by empty lines). fun void ParaDown=2413(,) fun void ParaDownExtend=2414(,) fun void ParaUp=2415(,) fun void ParaUpExtend=2416(,) # Given a valid document position, return the previous position taking code # page into account. Returns 0 if passed 0. fun position PositionBefore=2417(position pos,) # Given a valid document position, return the next position taking code # page into account. Maximum value returned is the last position in the document. fun position PositionAfter=2418(position pos,) # Copy a range of text to the clipboard. Positions are clipped into the document. fun void CopyRange=2419(position start, position end) # Copy argument text to the clipboard. fun void CopyText=2420(int length, string text) enu SelectionMode=SC_SEL_ val SC_SEL_STREAM=0 val SC_SEL_RECTANGLE=1 val SC_SEL_LINES=2 # Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or # by lines (SC_SEL_LINES). set void SetSelectionMode=2422(int mode,) # Get the mode of the current selection. get int GetSelectionMode=2423(,) # Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). fun position GetLineSelStartPosition=2424(int line,) # Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). fun position GetLineSelEndPosition=2425(int line,) ## RectExtended rectangular selection moves # Move caret down one line, extending rectangular selection to new caret position. fun void LineDownRectExtend=2426(,) # Move caret up one line, extending rectangular selection to new caret position. fun void LineUpRectExtend=2427(,) # Move caret left one character, extending rectangular selection to new caret position. fun void CharLeftRectExtend=2428(,) # Move caret right one character, extending rectangular selection to new caret position. fun void CharRightRectExtend=2429(,) # Move caret to first position on line, extending rectangular selection to new caret position. fun void HomeRectExtend=2430(,) # Move caret to before first visible character on line. # If already there move to first character on line. # In either case, extend rectangular selection to new caret position. fun void VCHomeRectExtend=2431(,) # Move caret to last position on line, extending rectangular selection to new caret position. fun void LineEndRectExtend=2432(,) # Move caret one page up, extending rectangular selection to new caret position. fun void PageUpRectExtend=2433(,) # Move caret one page down, extending rectangular selection to new caret position. fun void PageDownRectExtend=2434(,) # Move caret to top of page, or one page up if already at top of page. fun void StutteredPageUp=2435(,) # Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. fun void StutteredPageUpExtend=2436(,) # Move caret to bottom of page, or one page down if already at bottom of page. fun void StutteredPageDown=2437(,) # Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. fun void StutteredPageDownExtend=2438(,) # Move caret left one word, position cursor at end of word. fun void WordLeftEnd=2439(,) # Move caret left one word, position cursor at end of word, extending selection to new caret position. fun void WordLeftEndExtend=2440(,) # Move caret right one word, position cursor at end of word. fun void WordRightEnd=2441(,) # Move caret right one word, position cursor at end of word, extending selection to new caret position. fun void WordRightEndExtend=2442(,) # Set the set of characters making up whitespace for when moving or selecting by word. # Should be called after SetWordChars. set void SetWhitespaceChars=2443(, string characters) # Reset the set of characters for whitespace and word characters to the defaults. fun void SetCharsDefault=2444(,) # Get currently selected item position in the auto-completion list fun int AutoCGetCurrent=2445(,) # Enlarge the document to a particular size of text bytes. fun void Allocate=2446(int bytes,) # Returns the target converted to UTF8. # Return the length in bytes. fun int TargetAsUTF8=2447(, stringresult s) # Set the length of the utf8 argument for calling EncodedFromUTF8. # Set to -1 and the string will be measured to the first nul. fun void SetLengthForEncode=2448(int bytes,) # Translates a UTF8 string into the document encoding. # Return the length of the result in bytes. # On error return 0. fun int EncodedFromUTF8=2449(string utf8, stringresult encoded) # Find the position of a column on a line taking into account tabs and # multi-byte characters. If beyond end of line, return line end position. fun int FindColumn=2456(int line, int column) # Can the caret preferred x position only be changed by explicit movement commands? get bool GetCaretSticky=2457(,) # Stop the caret preferred x position changing when the user types. set void SetCaretSticky=2458(bool useCaretStickyBehaviour,) # Switch between sticky and non-sticky: meant to be bound to a key. fun void ToggleCaretSticky=2459(,) # Enable/Disable convert-on-paste for line endings set void SetPasteConvertEndings=2467(bool convert,) # Get convert-on-paste setting get bool GetPasteConvertEndings=2468(,) # Duplicate the selection. If selection empty duplicate the line containing the caret. fun void SelectionDuplicate=2469(,) val SC_ALPHA_TRANSPARENT=0 val SC_ALPHA_OPAQUE=255 val SC_ALPHA_NOALPHA=256 # Set background alpha of the caret line. set void SetCaretLineBackAlpha=2470(int alpha,) # Get the background alpha of the caret line. get int GetCaretLineBackAlpha=2471(,) enu CaretStyle=CARETSTYLE_ val CARETSTYLE_INVISIBLE=0 val CARETSTYLE_LINE=1 val CARETSTYLE_BLOCK=2 # Set the style of the caret to be drawn. set void SetCaretStyle=2512(int caretStyle,) # Returns the current style of the caret. get int GetCaretStyle=2513(,) # Set the indicator used for IndicatorFillRange and IndicatorClearRange set void SetIndicatorCurrent=2500(int indicator,) # Get the current indicator get int GetIndicatorCurrent=2501(,) # Set the value used for IndicatorFillRange set void SetIndicatorValue=2502(int value,) # Get the current indicator vaue get int GetIndicatorValue=2503(,) # Turn a indicator on over a range. fun void IndicatorFillRange=2504(int position, int fillLength) # Turn a indicator off over a range. fun void IndicatorClearRange=2505(int position, int clearLength) # Are any indicators present at position? fun int IndicatorAllOnFor=2506(int position,) # What value does a particular indicator have at at a position? fun int IndicatorValueAt=2507(int indicator, int position) # Where does a particular indicator start? fun int IndicatorStart=2508(int indicator, int position) # Where does a particular indicator end? fun int IndicatorEnd=2509(int indicator, int position) # Set number of entries in position cache set void SetPositionCache=2514(int size,) # How many entries are allocated to the position cache? get int GetPositionCache=2515(,) # Start notifying the container of all key presses and commands. fun void StartRecord=3001(,) # Stop notifying the container of all key presses and commands. fun void StopRecord=3002(,) # Set the lexing language of the document. set void SetLexer=4001(int lexer,) # Retrieve the lexing language of the document. get int GetLexer=4002(,) # Colourise a segment of the document using the current lexing language. fun void Colourise=4003(position start, position end) # Set up a value that may be used by a lexer for some optional feature. set void SetProperty=4004(string key, string value) # Maximum value of keywordSet parameter of SetKeyWords. val KEYWORDSET_MAX=8 # Set up the key words used by the lexer. set void SetKeyWords=4005(int keywordSet, string keyWords) # Set the lexing language of the document based on string name. set void SetLexerLanguage=4006(, string language) # Load a lexer library (dll / so). fun void LoadLexerLibrary=4007(, string path) # Retrieve a "property" value previously set with SetProperty. fun int GetProperty=4008(string key, stringresult buf) # Retrieve a "property" value previously set with SetProperty, # with "$()" variable replacement on returned buffer. fun int GetPropertyExpanded=4009(string key, stringresult buf) # Retrieve a "property" value previously set with SetProperty, # interpreted as an int AFTER any "$()" variable replacement. get int GetPropertyInt=4010(string key,) # Retrieve the number of bits the current lexer needs for styling. get int GetStyleBitsNeeded=4011(,) # Notifications # Type of modification and the action which caused the modification. # These are defined as a bit mask to make it easy to specify which notifications are wanted. # One bit is set from each of SC_MOD_* and SC_PERFORMED_*. enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_LAST val SC_MOD_INSERTTEXT=0x1 val SC_MOD_DELETETEXT=0x2 val SC_MOD_CHANGESTYLE=0x4 val SC_MOD_CHANGEFOLD=0x8 val SC_PERFORMED_USER=0x10 val SC_PERFORMED_UNDO=0x20 val SC_PERFORMED_REDO=0x40 val SC_MULTISTEPUNDOREDO=0x80 val SC_LASTSTEPINUNDOREDO=0x100 val SC_MOD_CHANGEMARKER=0x200 val SC_MOD_BEFOREINSERT=0x400 val SC_MOD_BEFOREDELETE=0x800 val SC_MULTILINEUNDOREDO=0x1000 val SC_STARTACTION=0x2000 val SC_MOD_CHANGEINDICATOR=0x4000 val SC_MODEVENTMASKALL=0x6FFF # For compatibility, these go through the COMMAND notification rather than NOTIFY # and should have had exactly the same values as the EN_* constants. # Unfortunately the SETFOCUS and KILLFOCUS are flipped over from EN_* # As clients depend on these constants, this will not be changed. val SCEN_CHANGE=768 val SCEN_SETFOCUS=512 val SCEN_KILLFOCUS=256 # Symbolic key codes and modifier flags. # ASCII and other printable characters below 256. # Extended keys above 300. enu Keys=SCK_ val SCK_DOWN=300 val SCK_UP=301 val SCK_LEFT=302 val SCK_RIGHT=303 val SCK_HOME=304 val SCK_END=305 val SCK_PRIOR=306 val SCK_NEXT=307 val SCK_DELETE=308 val SCK_INSERT=309 val SCK_ESCAPE=7 val SCK_BACK=8 val SCK_TAB=9 val SCK_RETURN=13 val SCK_ADD=310 val SCK_SUBTRACT=311 val SCK_DIVIDE=312 val SCK_WIN=313 val SCK_RWIN=314 val SCK_MENU=315 enu KeyMod=SCMOD_ val SCMOD_NORM=0 val SCMOD_SHIFT=1 val SCMOD_CTRL=2 val SCMOD_ALT=4 ################################################ # For SciLexer.h enu Lexer=SCLEX_ val SCLEX_CONTAINER=0 val SCLEX_NULL=1 val SCLEX_PYTHON=2 val SCLEX_CPP=3 val SCLEX_HTML=4 val SCLEX_XML=5 val SCLEX_PERL=6 val SCLEX_SQL=7 val SCLEX_VB=8 val SCLEX_PROPERTIES=9 val SCLEX_ERRORLIST=10 val SCLEX_MAKEFILE=11 val SCLEX_BATCH=12 val SCLEX_XCODE=13 val SCLEX_LATEX=14 val SCLEX_LUA=15 val SCLEX_DIFF=16 val SCLEX_CONF=17 val SCLEX_PASCAL=18 val SCLEX_AVE=19 val SCLEX_ADA=20 val SCLEX_LISP=21 val SCLEX_RUBY=22 val SCLEX_EIFFEL=23 val SCLEX_EIFFELKW=24 val SCLEX_TCL=25 val SCLEX_NNCRONTAB=26 val SCLEX_BULLANT=27 val SCLEX_VBSCRIPT=28 val SCLEX_BAAN=31 val SCLEX_MATLAB=32 val SCLEX_SCRIPTOL=33 val SCLEX_ASM=34 val SCLEX_CPPNOCASE=35 val SCLEX_FORTRAN=36 val SCLEX_F77=37 val SCLEX_CSS=38 val SCLEX_POV=39 val SCLEX_LOUT=40 val SCLEX_ESCRIPT=41 val SCLEX_PS=42 val SCLEX_NSIS=43 val SCLEX_MMIXAL=44 val SCLEX_CLW=45 val SCLEX_CLWNOCASE=46 val SCLEX_LOT=47 val SCLEX_YAML=48 val SCLEX_TEX=49 val SCLEX_METAPOST=50 val SCLEX_POWERBASIC=51 val SCLEX_FORTH=52 val SCLEX_ERLANG=53 val SCLEX_OCTAVE=54 val SCLEX_MSSQL=55 val SCLEX_VERILOG=56 val SCLEX_KIX=57 val SCLEX_GUI4CLI=58 val SCLEX_SPECMAN=59 val SCLEX_AU3=60 val SCLEX_APDL=61 val SCLEX_BASH=62 val SCLEX_ASN1=63 val SCLEX_VHDL=64 val SCLEX_CAML=65 val SCLEX_BLITZBASIC=66 val SCLEX_PUREBASIC=67 val SCLEX_HASKELL=68 val SCLEX_PHPSCRIPT=69 val SCLEX_TADS3=70 val SCLEX_REBOL=71 val SCLEX_SMALLTALK=72 val SCLEX_FLAGSHIP=73 val SCLEX_CSOUND=74 val SCLEX_FREEBASIC=75 val SCLEX_INNOSETUP=76 val SCLEX_OPAL=77 val SCLEX_SPICE=78 val SCLEX_D=79 val SCLEX_CMAKE=80 val SCLEX_GAP=81 val SCLEX_PLM=82 val SCLEX_PROGRESS=83 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. val SCLEX_AUTOMATIC=1000 # Lexical states for SCLEX_PYTHON lex Python=SCLEX_PYTHON SCE_P_ val SCE_P_DEFAULT=0 val SCE_P_COMMENTLINE=1 val SCE_P_NUMBER=2 val SCE_P_STRING=3 val SCE_P_CHARACTER=4 val SCE_P_WORD=5 val SCE_P_TRIPLE=6 val SCE_P_TRIPLEDOUBLE=7 val SCE_P_CLASSNAME=8 val SCE_P_DEFNAME=9 val SCE_P_OPERATOR=10 val SCE_P_IDENTIFIER=11 val SCE_P_COMMENTBLOCK=12 val SCE_P_STRINGEOL=13 val SCE_P_WORD2=14 val SCE_P_DECORATOR=15 # Lexical states for SCLEX_CPP lex Cpp=SCLEX_CPP SCE_C_ lex Pascal=SCLEX_PASCAL SCE_C_ lex BullAnt=SCLEX_BULLANT SCE_C_ val SCE_C_DEFAULT=0 val SCE_C_COMMENT=1 val SCE_C_COMMENTLINE=2 val SCE_C_COMMENTDOC=3 val SCE_C_NUMBER=4 val SCE_C_WORD=5 val SCE_C_STRING=6 val SCE_C_CHARACTER=7 val SCE_C_UUID=8 val SCE_C_PREPROCESSOR=9 val SCE_C_OPERATOR=10 val SCE_C_IDENTIFIER=11 val SCE_C_STRINGEOL=12 val SCE_C_VERBATIM=13 val SCE_C_REGEX=14 val SCE_C_COMMENTLINEDOC=15 val SCE_C_WORD2=16 val SCE_C_COMMENTDOCKEYWORD=17 val SCE_C_COMMENTDOCKEYWORDERROR=18 val SCE_C_GLOBALCLASS=19 # Lexical states for SCLEX_D lex D=SCLEX_D SCE_D_ val SCE_D_DEFAULT=0 val SCE_D_COMMENT=1 val SCE_D_COMMENTLINE=2 val SCE_D_COMMENTDOC=3 val SCE_D_COMMENTNESTED=4 val SCE_D_NUMBER=5 val SCE_D_WORD=6 val SCE_D_WORD2=7 val SCE_D_WORD3=8 val SCE_D_TYPEDEF=9 val SCE_D_STRING=10 val SCE_D_STRINGEOL=11 val SCE_D_CHARACTER=12 val SCE_D_OPERATOR=13 val SCE_D_IDENTIFIER=14 val SCE_D_COMMENTLINEDOC=15 val SCE_D_COMMENTDOCKEYWORD=16 val SCE_D_COMMENTDOCKEYWORDERROR=17 # Lexical states for SCLEX_TCL lex TCL=SCLEX_TCL SCE_TCL_ val SCE_TCL_DEFAULT=0 val SCE_TCL_COMMENT=1 val SCE_TCL_COMMENTLINE=2 val SCE_TCL_NUMBER=3 val SCE_TCL_WORD_IN_QUOTE=4 val SCE_TCL_IN_QUOTE=5 val SCE_TCL_OPERATOR=6 val SCE_TCL_IDENTIFIER=7 val SCE_TCL_SUBSTITUTION=8 val SCE_TCL_SUB_BRACE=9 val SCE_TCL_MODIFIER=10 val SCE_TCL_EXPAND=11 val SCE_TCL_WORD=12 val SCE_TCL_WORD2=13 val SCE_TCL_WORD3=14 val SCE_TCL_WORD4=15 val SCE_TCL_WORD5=16 val SCE_TCL_WORD6=17 val SCE_TCL_WORD7=18 val SCE_TCL_WORD8=19 val SCE_TCL_COMMENT_BOX=20 val SCE_TCL_BLOCK_COMMENT=21 # Lexical states for SCLEX_HTML, SCLEX_XML lex HTML=SCLEX_HTML SCE_H lex XML=SCLEX_XML SCE_H lex ASP=SCLEX_ASP SCE_H lex PHP=SCLEX_PHP SCE_H val SCE_H_DEFAULT=0 val SCE_H_TAG=1 val SCE_H_TAGUNKNOWN=2 val SCE_H_ATTRIBUTE=3 val SCE_H_ATTRIBUTEUNKNOWN=4 val SCE_H_NUMBER=5 val SCE_H_DOUBLESTRING=6 val SCE_H_SINGLESTRING=7 val SCE_H_OTHER=8 val SCE_H_COMMENT=9 val SCE_H_ENTITY=10 # XML and ASP val SCE_H_TAGEND=11 val SCE_H_XMLSTART=12 val SCE_H_XMLEND=13 val SCE_H_SCRIPT=14 val SCE_H_ASP=15 val SCE_H_ASPAT=16 val SCE_H_CDATA=17 val SCE_H_QUESTION=18 # More HTML val SCE_H_VALUE=19 # X-Code val SCE_H_XCCOMMENT=20 # SGML val SCE_H_SGML_DEFAULT=21 val SCE_H_SGML_COMMAND=22 val SCE_H_SGML_1ST_PARAM=23 val SCE_H_SGML_DOUBLESTRING=24 val SCE_H_SGML_SIMPLESTRING=25 val SCE_H_SGML_ERROR=26 val SCE_H_SGML_SPECIAL=27 val SCE_H_SGML_ENTITY=28 val SCE_H_SGML_COMMENT=29 val SCE_H_SGML_1ST_PARAM_COMMENT=30 val SCE_H_SGML_BLOCK_DEFAULT=31 # Embedded Javascript val SCE_HJ_START=40 val SCE_HJ_DEFAULT=41 val SCE_HJ_COMMENT=42 val SCE_HJ_COMMENTLINE=43 val SCE_HJ_COMMENTDOC=44 val SCE_HJ_NUMBER=45 val SCE_HJ_WORD=46 val SCE_HJ_KEYWORD=47 val SCE_HJ_DOUBLESTRING=48 val SCE_HJ_SINGLESTRING=49 val SCE_HJ_SYMBOLS=50 val SCE_HJ_STRINGEOL=51 val SCE_HJ_REGEX=52 # ASP Javascript val SCE_HJA_START=55 val SCE_HJA_DEFAULT=56 val SCE_HJA_COMMENT=57 val SCE_HJA_COMMENTLINE=58 val SCE_HJA_COMMENTDOC=59 val SCE_HJA_NUMBER=60 val SCE_HJA_WORD=61 val SCE_HJA_KEYWORD=62 val SCE_HJA_DOUBLESTRING=63 val SCE_HJA_SINGLESTRING=64 val SCE_HJA_SYMBOLS=65 val SCE_HJA_STRINGEOL=66 val SCE_HJA_REGEX=67 # Embedded VBScript val SCE_HB_START=70 val SCE_HB_DEFAULT=71 val SCE_HB_COMMENTLINE=72 val SCE_HB_NUMBER=73 val SCE_HB_WORD=74 val SCE_HB_STRING=75 val SCE_HB_IDENTIFIER=76 val SCE_HB_STRINGEOL=77 # ASP VBScript val SCE_HBA_START=80 val SCE_HBA_DEFAULT=81 val SCE_HBA_COMMENTLINE=82 val SCE_HBA_NUMBER=83 val SCE_HBA_WORD=84 val SCE_HBA_STRING=85 val SCE_HBA_IDENTIFIER=86 val SCE_HBA_STRINGEOL=87 # Embedded Python val SCE_HP_START=90 val SCE_HP_DEFAULT=91 val SCE_HP_COMMENTLINE=92 val SCE_HP_NUMBER=93 val SCE_HP_STRING=94 val SCE_HP_CHARACTER=95 val SCE_HP_WORD=96 val SCE_HP_TRIPLE=97 val SCE_HP_TRIPLEDOUBLE=98 val SCE_HP_CLASSNAME=99 val SCE_HP_DEFNAME=100 val SCE_HP_OPERATOR=101 val SCE_HP_IDENTIFIER=102 # PHP val SCE_HPHP_COMPLEX_VARIABLE=104 # ASP Python val SCE_HPA_START=105 val SCE_HPA_DEFAULT=106 val SCE_HPA_COMMENTLINE=107 val SCE_HPA_NUMBER=108 val SCE_HPA_STRING=109 val SCE_HPA_CHARACTER=110 val SCE_HPA_WORD=111 val SCE_HPA_TRIPLE=112 val SCE_HPA_TRIPLEDOUBLE=113 val SCE_HPA_CLASSNAME=114 val SCE_HPA_DEFNAME=115 val SCE_HPA_OPERATOR=116 val SCE_HPA_IDENTIFIER=117 # PHP val SCE_HPHP_DEFAULT=118 val SCE_HPHP_HSTRING=119 val SCE_HPHP_SIMPLESTRING=120 val SCE_HPHP_WORD=121 val SCE_HPHP_NUMBER=122 val SCE_HPHP_VARIABLE=123 val SCE_HPHP_COMMENT=124 val SCE_HPHP_COMMENTLINE=125 val SCE_HPHP_HSTRING_VARIABLE=126 val SCE_HPHP_OPERATOR=127 # Lexical states for SCLEX_PERL lex Perl=SCLEX_PERL SCE_PL_ val SCE_PL_DEFAULT=0 val SCE_PL_ERROR=1 val SCE_PL_COMMENTLINE=2 val SCE_PL_POD=3 val SCE_PL_NUMBER=4 val SCE_PL_WORD=5 val SCE_PL_STRING=6 val SCE_PL_CHARACTER=7 val SCE_PL_PUNCTUATION=8 val SCE_PL_PREPROCESSOR=9 val SCE_PL_OPERATOR=10 val SCE_PL_IDENTIFIER=11 val SCE_PL_SCALAR=12 val SCE_PL_ARRAY=13 val SCE_PL_HASH=14 val SCE_PL_SYMBOLTABLE=15 val SCE_PL_VARIABLE_INDEXER=16 val SCE_PL_REGEX=17 val SCE_PL_REGSUBST=18 val SCE_PL_LONGQUOTE=19 val SCE_PL_BACKTICKS=20 val SCE_PL_DATASECTION=21 val SCE_PL_HERE_DELIM=22 val SCE_PL_HERE_Q=23 val SCE_PL_HERE_QQ=24 val SCE_PL_HERE_QX=25 val SCE_PL_STRING_Q=26 val SCE_PL_STRING_QQ=27 val SCE_PL_STRING_QX=28 val SCE_PL_STRING_QR=29 val SCE_PL_STRING_QW=30 val SCE_PL_POD_VERB=31 # Lexical states for SCLEX_RUBY lex Ruby=SCLEX_RUBY SCE_RB_ val SCE_RB_DEFAULT=0 val SCE_RB_ERROR=1 val SCE_RB_COMMENTLINE=2 val SCE_RB_POD=3 val SCE_RB_NUMBER=4 val SCE_RB_WORD=5 val SCE_RB_STRING=6 val SCE_RB_CHARACTER=7 val SCE_RB_CLASSNAME=8 val SCE_RB_DEFNAME=9 val SCE_RB_OPERATOR=10 val SCE_RB_IDENTIFIER=11 val SCE_RB_REGEX=12 val SCE_RB_GLOBAL=13 val SCE_RB_SYMBOL=14 val SCE_RB_MODULE_NAME=15 val SCE_RB_INSTANCE_VAR=16 val SCE_RB_CLASS_VAR=17 val SCE_RB_BACKTICKS=18 val SCE_RB_DATASECTION=19 val SCE_RB_HERE_DELIM=20 val SCE_RB_HERE_Q=21 val SCE_RB_HERE_QQ=22 val SCE_RB_HERE_QX=23 val SCE_RB_STRING_Q=24 val SCE_RB_STRING_QQ=25 val SCE_RB_STRING_QX=26 val SCE_RB_STRING_QR=27 val SCE_RB_STRING_QW=28 val SCE_RB_WORD_DEMOTED=29 val SCE_RB_STDIN=30 val SCE_RB_STDOUT=31 val SCE_RB_STDERR=40 val SCE_RB_UPPER_BOUND=41 # Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC lex VB=SCLEX_VB SCE_B_ lex VBScript=SCLEX_VBSCRIPT SCE_B_ lex PowerBasic=SCLEX_POWERBASIC SCE_B_ val SCE_B_DEFAULT=0 val SCE_B_COMMENT=1 val SCE_B_NUMBER=2 val SCE_B_KEYWORD=3 val SCE_B_STRING=4 val SCE_B_PREPROCESSOR=5 val SCE_B_OPERATOR=6 val SCE_B_IDENTIFIER=7 val SCE_B_DATE=8 val SCE_B_STRINGEOL=9 val SCE_B_KEYWORD2=10 val SCE_B_KEYWORD3=11 val SCE_B_KEYWORD4=12 val SCE_B_CONSTANT=13 val SCE_B_ASM=14 val SCE_B_LABEL=15 val SCE_B_ERROR=16 val SCE_B_HEXNUMBER=17 val SCE_B_BINNUMBER=18 # Lexical states for SCLEX_PROPERTIES lex Properties=SCLEX_PROPERTIES SCE_PROPS_ val SCE_PROPS_DEFAULT=0 val SCE_PROPS_COMMENT=1 val SCE_PROPS_SECTION=2 val SCE_PROPS_ASSIGNMENT=3 val SCE_PROPS_DEFVAL=4 val SCE_PROPS_KEY=5 # Lexical states for SCLEX_LATEX lex LaTeX=SCLEX_LATEX SCE_L_ val SCE_L_DEFAULT=0 val SCE_L_COMMAND=1 val SCE_L_TAG=2 val SCE_L_MATH=3 val SCE_L_COMMENT=4 # Lexical states for SCLEX_LUA lex Lua=SCLEX_LUA SCE_LUA_ val SCE_LUA_DEFAULT=0 val SCE_LUA_COMMENT=1 val SCE_LUA_COMMENTLINE=2 val SCE_LUA_COMMENTDOC=3 val SCE_LUA_NUMBER=4 val SCE_LUA_WORD=5 val SCE_LUA_STRING=6 val SCE_LUA_CHARACTER=7 val SCE_LUA_LITERALSTRING=8 val SCE_LUA_PREPROCESSOR=9 val SCE_LUA_OPERATOR=10 val SCE_LUA_IDENTIFIER=11 val SCE_LUA_STRINGEOL=12 val SCE_LUA_WORD2=13 val SCE_LUA_WORD3=14 val SCE_LUA_WORD4=15 val SCE_LUA_WORD5=16 val SCE_LUA_WORD6=17 val SCE_LUA_WORD7=18 val SCE_LUA_WORD8=19 # Lexical states for SCLEX_ERRORLIST lex ErrorList=SCLEX_ERRORLIST SCE_ERR_ val SCE_ERR_DEFAULT=0 val SCE_ERR_PYTHON=1 val SCE_ERR_GCC=2 val SCE_ERR_MS=3 val SCE_ERR_CMD=4 val SCE_ERR_BORLAND=5 val SCE_ERR_PERL=6 val SCE_ERR_NET=7 val SCE_ERR_LUA=8 val SCE_ERR_CTAG=9 val SCE_ERR_DIFF_CHANGED=10 val SCE_ERR_DIFF_ADDITION=11 val SCE_ERR_DIFF_DELETION=12 val SCE_ERR_DIFF_MESSAGE=13 val SCE_ERR_PHP=14 val SCE_ERR_ELF=15 val SCE_ERR_IFC=16 val SCE_ERR_IFORT=17 val SCE_ERR_ABSF=18 val SCE_ERR_TIDY=19 val SCE_ERR_JAVA_STACK=20 # Lexical states for SCLEX_BATCH lex Batch=SCLEX_BATCH SCE_BAT_ val SCE_BAT_DEFAULT=0 val SCE_BAT_COMMENT=1 val SCE_BAT_WORD=2 val SCE_BAT_LABEL=3 val SCE_BAT_HIDE=4 val SCE_BAT_COMMAND=5 val SCE_BAT_IDENTIFIER=6 val SCE_BAT_OPERATOR=7 # Lexical states for SCLEX_MAKEFILE lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_ val SCE_MAKE_DEFAULT=0 val SCE_MAKE_COMMENT=1 val SCE_MAKE_PREPROCESSOR=2 val SCE_MAKE_IDENTIFIER=3 val SCE_MAKE_OPERATOR=4 val SCE_MAKE_TARGET=5 val SCE_MAKE_IDEOL=9 # Lexical states for SCLEX_DIFF lex Diff=SCLEX_DIFF SCE_DIFF_ val SCE_DIFF_DEFAULT=0 val SCE_DIFF_COMMENT=1 val SCE_DIFF_COMMAND=2 val SCE_DIFF_HEADER=3 val SCE_DIFF_POSITION=4 val SCE_DIFF_DELETED=5 val SCE_DIFF_ADDED=6 # Lexical states for SCLEX_CONF (Apache Configuration Files Lexer) lex Conf=SCLEX_CONF SCE_CONF_ val SCE_CONF_DEFAULT=0 val SCE_CONF_COMMENT=1 val SCE_CONF_NUMBER=2 val SCE_CONF_IDENTIFIER=3 val SCE_CONF_EXTENSION=4 val SCE_CONF_PARAMETER=5 val SCE_CONF_STRING=6 val SCE_CONF_OPERATOR=7 val SCE_CONF_IP=8 val SCE_CONF_DIRECTIVE=9 # Lexical states for SCLEX_AVE, Avenue lex Avenue=SCLEX_AVE SCE_AVE_ val SCE_AVE_DEFAULT=0 val SCE_AVE_COMMENT=1 val SCE_AVE_NUMBER=2 val SCE_AVE_WORD=3 val SCE_AVE_STRING=6 val SCE_AVE_ENUM=7 val SCE_AVE_STRINGEOL=8 val SCE_AVE_IDENTIFIER=9 val SCE_AVE_OPERATOR=10 val SCE_AVE_WORD1=11 val SCE_AVE_WORD2=12 val SCE_AVE_WORD3=13 val SCE_AVE_WORD4=14 val SCE_AVE_WORD5=15 val SCE_AVE_WORD6=16 # Lexical states for SCLEX_ADA lex Ada=SCLEX_ADA SCE_ADA_ val SCE_ADA_DEFAULT=0 val SCE_ADA_WORD=1 val SCE_ADA_IDENTIFIER=2 val SCE_ADA_NUMBER=3 val SCE_ADA_DELIMITER=4 val SCE_ADA_CHARACTER=5 val SCE_ADA_CHARACTEREOL=6 val SCE_ADA_STRING=7 val SCE_ADA_STRINGEOL=8 val SCE_ADA_LABEL=9 val SCE_ADA_COMMENTLINE=10 val SCE_ADA_ILLEGAL=11 # Lexical states for SCLEX_BAAN lex Baan=SCLEX_BAAN SCE_BAAN_ val SCE_BAAN_DEFAULT=0 val SCE_BAAN_COMMENT=1 val SCE_BAAN_COMMENTDOC=2 val SCE_BAAN_NUMBER=3 val SCE_BAAN_WORD=4 val SCE_BAAN_STRING=5 val SCE_BAAN_PREPROCESSOR=6 val SCE_BAAN_OPERATOR=7 val SCE_BAAN_IDENTIFIER=8 val SCE_BAAN_STRINGEOL=9 val SCE_BAAN_WORD2=10 # Lexical states for SCLEX_LISP lex Lisp=SCLEX_LISP SCE_LISP_ val SCE_LISP_DEFAULT=0 val SCE_LISP_COMMENT=1 val SCE_LISP_NUMBER=2 val SCE_LISP_KEYWORD=3 val SCE_LISP_KEYWORD_KW=4 val SCE_LISP_SYMBOL=5 val SCE_LISP_STRING=6 val SCE_LISP_STRINGEOL=8 val SCE_LISP_IDENTIFIER=9 val SCE_LISP_OPERATOR=10 val SCE_LISP_SPECIAL=11 val SCE_LISP_MULTI_COMMENT=12 # Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_ lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_ val SCE_EIFFEL_DEFAULT=0 val SCE_EIFFEL_COMMENTLINE=1 val SCE_EIFFEL_NUMBER=2 val SCE_EIFFEL_WORD=3 val SCE_EIFFEL_STRING=4 val SCE_EIFFEL_CHARACTER=5 val SCE_EIFFEL_OPERATOR=6 val SCE_EIFFEL_IDENTIFIER=7 val SCE_EIFFEL_STRINGEOL=8 # Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer) lex NNCronTab=SCLEX_NNCRONTAB SCE_NNCRONTAB_ val SCE_NNCRONTAB_DEFAULT=0 val SCE_NNCRONTAB_COMMENT=1 val SCE_NNCRONTAB_TASK=2 val SCE_NNCRONTAB_SECTION=3 val SCE_NNCRONTAB_KEYWORD=4 val SCE_NNCRONTAB_MODIFIER=5 val SCE_NNCRONTAB_ASTERISK=6 val SCE_NNCRONTAB_NUMBER=7 val SCE_NNCRONTAB_STRING=8 val SCE_NNCRONTAB_ENVIRONMENT=9 val SCE_NNCRONTAB_IDENTIFIER=10 # Lexical states for SCLEX_FORTH (Forth Lexer) lex Forth=SCLEX_FORTH SCE_FORTH_ val SCE_FORTH_DEFAULT=0 val SCE_FORTH_COMMENT=1 val SCE_FORTH_COMMENT_ML=2 val SCE_FORTH_IDENTIFIER=3 val SCE_FORTH_CONTROL=4 val SCE_FORTH_KEYWORD=5 val SCE_FORTH_DEFWORD=6 val SCE_FORTH_PREWORD1=7 val SCE_FORTH_PREWORD2=8 val SCE_FORTH_NUMBER=9 val SCE_FORTH_STRING=10 val SCE_FORTH_LOCALE=11 # Lexical states for SCLEX_MATLAB lex MatLab=SCLEX_MATLAB SCE_MATLAB_ val SCE_MATLAB_DEFAULT=0 val SCE_MATLAB_COMMENT=1 val SCE_MATLAB_COMMAND=2 val SCE_MATLAB_NUMBER=3 val SCE_MATLAB_KEYWORD=4 # single quoted string val SCE_MATLAB_STRING=5 val SCE_MATLAB_OPERATOR=6 val SCE_MATLAB_IDENTIFIER=7 val SCE_MATLAB_DOUBLEQUOTESTRING=8 # Lexical states for SCLEX_SCRIPTOL lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_ val SCE_SCRIPTOL_DEFAULT=0 val SCE_SCRIPTOL_WHITE=1 val SCE_SCRIPTOL_COMMENTLINE=2 val SCE_SCRIPTOL_PERSISTENT=3 val SCE_SCRIPTOL_CSTYLE=4 val SCE_SCRIPTOL_COMMENTBLOCK=5 val SCE_SCRIPTOL_NUMBER=6 val SCE_SCRIPTOL_STRING=7 val SCE_SCRIPTOL_CHARACTER=8 val SCE_SCRIPTOL_STRINGEOL=9 val SCE_SCRIPTOL_KEYWORD=10 val SCE_SCRIPTOL_OPERATOR=11 val SCE_SCRIPTOL_IDENTIFIER=12 val SCE_SCRIPTOL_TRIPLE=13 val SCE_SCRIPTOL_CLASSNAME=14 val SCE_SCRIPTOL_PREPROCESSOR=15 # Lexical states for SCLEX_ASM lex Asm=SCLEX_ASM SCE_ASM_ val SCE_ASM_DEFAULT=0 val SCE_ASM_COMMENT=1 val SCE_ASM_NUMBER=2 val SCE_ASM_STRING=3 val SCE_ASM_OPERATOR=4 val SCE_ASM_IDENTIFIER=5 val SCE_ASM_CPUINSTRUCTION=6 val SCE_ASM_MATHINSTRUCTION=7 val SCE_ASM_REGISTER=8 val SCE_ASM_DIRECTIVE=9 val SCE_ASM_DIRECTIVEOPERAND=10 val SCE_ASM_COMMENTBLOCK=11 val SCE_ASM_CHARACTER=12 val SCE_ASM_STRINGEOL=13 val SCE_ASM_EXTINSTRUCTION=14 # Lexical states for SCLEX_FORTRAN lex Fortran=SCLEX_FORTRAN SCE_F_ lex F77=SCLEX_F77 SCE_F_ val SCE_F_DEFAULT=0 val SCE_F_COMMENT=1 val SCE_F_NUMBER=2 val SCE_F_STRING1=3 val SCE_F_STRING2=4 val SCE_F_STRINGEOL=5 val SCE_F_OPERATOR=6 val SCE_F_IDENTIFIER=7 val SCE_F_WORD=8 val SCE_F_WORD2=9 val SCE_F_WORD3=10 val SCE_F_PREPROCESSOR=11 val SCE_F_OPERATOR2=12 val SCE_F_LABEL=13 val SCE_F_CONTINUATION=14 # Lexical states for SCLEX_CSS lex CSS=SCLEX_CSS SCE_CSS_ val SCE_CSS_DEFAULT=0 val SCE_CSS_TAG=1 val SCE_CSS_CLASS=2 val SCE_CSS_PSEUDOCLASS=3 val SCE_CSS_UNKNOWN_PSEUDOCLASS=4 val SCE_CSS_OPERATOR=5 val SCE_CSS_IDENTIFIER=6 val SCE_CSS_UNKNOWN_IDENTIFIER=7 val SCE_CSS_VALUE=8 val SCE_CSS_COMMENT=9 val SCE_CSS_ID=10 val SCE_CSS_IMPORTANT=11 val SCE_CSS_DIRECTIVE=12 val SCE_CSS_DOUBLESTRING=13 val SCE_CSS_SINGLESTRING=14 val SCE_CSS_IDENTIFIER2=15 val SCE_CSS_ATTRIBUTE=16 # Lexical states for SCLEX_POV lex POV=SCLEX_POV SCE_POV_ val SCE_POV_DEFAULT=0 val SCE_POV_COMMENT=1 val SCE_POV_COMMENTLINE=2 val SCE_POV_NUMBER=3 val SCE_POV_OPERATOR=4 val SCE_POV_IDENTIFIER=5 val SCE_POV_STRING=6 val SCE_POV_STRINGEOL=7 val SCE_POV_DIRECTIVE=8 val SCE_POV_BADDIRECTIVE=9 val SCE_POV_WORD2=10 val SCE_POV_WORD3=11 val SCE_POV_WORD4=12 val SCE_POV_WORD5=13 val SCE_POV_WORD6=14 val SCE_POV_WORD7=15 val SCE_POV_WORD8=16 # Lexical states for SCLEX_LOUT lex LOUT=SCLEX_LOUT SCE_LOUT_ val SCE_LOUT_DEFAULT=0 val SCE_LOUT_COMMENT=1 val SCE_LOUT_NUMBER=2 val SCE_LOUT_WORD=3 val SCE_LOUT_WORD2=4 val SCE_LOUT_WORD3=5 val SCE_LOUT_WORD4=6 val SCE_LOUT_STRING=7 val SCE_LOUT_OPERATOR=8 val SCE_LOUT_IDENTIFIER=9 val SCE_LOUT_STRINGEOL=10 # Lexical states for SCLEX_ESCRIPT lex ESCRIPT=SCLEX_ESCRIPT SCE_ESCRIPT_ val SCE_ESCRIPT_DEFAULT=0 val SCE_ESCRIPT_COMMENT=1 val SCE_ESCRIPT_COMMENTLINE=2 val SCE_ESCRIPT_COMMENTDOC=3 val SCE_ESCRIPT_NUMBER=4 val SCE_ESCRIPT_WORD=5 val SCE_ESCRIPT_STRING=6 val SCE_ESCRIPT_OPERATOR=7 val SCE_ESCRIPT_IDENTIFIER=8 val SCE_ESCRIPT_BRACE=9 val SCE_ESCRIPT_WORD2=10 val SCE_ESCRIPT_WORD3=11 # Lexical states for SCLEX_PS lex PS=SCLEX_PS SCE_PS_ val SCE_PS_DEFAULT=0 val SCE_PS_COMMENT=1 val SCE_PS_DSC_COMMENT=2 val SCE_PS_DSC_VALUE=3 val SCE_PS_NUMBER=4 val SCE_PS_NAME=5 val SCE_PS_KEYWORD=6 val SCE_PS_LITERAL=7 val SCE_PS_IMMEVAL=8 val SCE_PS_PAREN_ARRAY=9 val SCE_PS_PAREN_DICT=10 val SCE_PS_PAREN_PROC=11 val SCE_PS_TEXT=12 val SCE_PS_HEXSTRING=13 val SCE_PS_BASE85STRING=14 val SCE_PS_BADSTRINGCHAR=15 # Lexical states for SCLEX_NSIS lex NSIS=SCLEX_NSIS SCE_NSIS_ val SCE_NSIS_DEFAULT=0 val SCE_NSIS_COMMENT=1 val SCE_NSIS_STRINGDQ=2 val SCE_NSIS_STRINGLQ=3 val SCE_NSIS_STRINGRQ=4 val SCE_NSIS_FUNCTION=5 val SCE_NSIS_VARIABLE=6 val SCE_NSIS_LABEL=7 val SCE_NSIS_USERDEFINED=8 val SCE_NSIS_SECTIONDEF=9 val SCE_NSIS_SUBSECTIONDEF=10 val SCE_NSIS_IFDEFINEDEF=11 val SCE_NSIS_MACRODEF=12 val SCE_NSIS_STRINGVAR=13 val SCE_NSIS_NUMBER=14 val SCE_NSIS_SECTIONGROUP=15 val SCE_NSIS_PAGEEX=16 val SCE_NSIS_FUNCTIONDEF=17 val SCE_NSIS_COMMENTBOX=18 # Lexical states for SCLEX_MMIXAL lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_ val SCE_MMIXAL_LEADWS=0 val SCE_MMIXAL_COMMENT=1 val SCE_MMIXAL_LABEL=2 val SCE_MMIXAL_OPCODE=3 val SCE_MMIXAL_OPCODE_PRE=4 val SCE_MMIXAL_OPCODE_VALID=5 val SCE_MMIXAL_OPCODE_UNKNOWN=6 val SCE_MMIXAL_OPCODE_POST=7 val SCE_MMIXAL_OPERANDS=8 val SCE_MMIXAL_NUMBER=9 val SCE_MMIXAL_REF=10 val SCE_MMIXAL_CHAR=11 val SCE_MMIXAL_STRING=12 val SCE_MMIXAL_REGISTER=13 val SCE_MMIXAL_HEX=14 val SCE_MMIXAL_OPERATOR=15 val SCE_MMIXAL_SYMBOL=16 val SCE_MMIXAL_INCLUDE=17 # Lexical states for SCLEX_CLW lex Clarion=SCLEX_CLW SCE_CLW_ val SCE_CLW_DEFAULT=0 val SCE_CLW_LABEL=1 val SCE_CLW_COMMENT=2 val SCE_CLW_STRING=3 val SCE_CLW_USER_IDENTIFIER=4 val SCE_CLW_INTEGER_CONSTANT=5 val SCE_CLW_REAL_CONSTANT=6 val SCE_CLW_PICTURE_STRING=7 val SCE_CLW_KEYWORD=8 val SCE_CLW_COMPILER_DIRECTIVE=9 val SCE_CLW_RUNTIME_EXPRESSIONS=10 val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=11 val SCE_CLW_STRUCTURE_DATA_TYPE=12 val SCE_CLW_ATTRIBUTE=13 val SCE_CLW_STANDARD_EQUATE=14 val SCE_CLW_ERROR=15 val SCE_CLW_DEPRECATED=16 # Lexical states for SCLEX_LOT lex LOT=SCLEX_LOT SCE_LOT_ val SCE_LOT_DEFAULT=0 val SCE_LOT_HEADER=1 val SCE_LOT_BREAK=2 val SCE_LOT_SET=3 val SCE_LOT_PASS=4 val SCE_LOT_FAIL=5 val SCE_LOT_ABORT=6 # Lexical states for SCLEX_YAML lex YAML=SCLEX_YAML SCE_YAML_ val SCE_YAML_DEFAULT=0 val SCE_YAML_COMMENT=1 val SCE_YAML_IDENTIFIER=2 val SCE_YAML_KEYWORD=3 val SCE_YAML_NUMBER=4 val SCE_YAML_REFERENCE=5 val SCE_YAML_DOCUMENT=6 val SCE_YAML_TEXT=7 val SCE_YAML_ERROR=8 # Lexical states for SCLEX_TEX lex TeX=SCLEX_TEX SCE_TEX_ val SCE_TEX_DEFAULT=0 val SCE_TEX_SPECIAL=1 val SCE_TEX_GROUP=2 val SCE_TEX_SYMBOL=3 val SCE_TEX_COMMAND=4 val SCE_TEX_TEXT=5 lex Metapost=SCLEX_METAPOST SCE_METAPOST_ val SCE_METAPOST_DEFAULT=0 val SCE_METAPOST_SPECIAL=1 val SCE_METAPOST_GROUP=2 val SCE_METAPOST_SYMBOL=3 val SCE_METAPOST_COMMAND=4 val SCE_METAPOST_TEXT=5 val SCE_METAPOST_EXTRA=6 # Lexical states for SCLEX_ERLANG lex Erlang=SCLEX_ERLANG SCE_ERLANG_ val SCE_ERLANG_DEFAULT=0 val SCE_ERLANG_COMMENT=1 val SCE_ERLANG_VARIABLE=2 val SCE_ERLANG_NUMBER=3 val SCE_ERLANG_KEYWORD=4 val SCE_ERLANG_STRING=5 val SCE_ERLANG_OPERATOR=6 val SCE_ERLANG_ATOM=7 val SCE_ERLANG_FUNCTION_NAME=8 val SCE_ERLANG_CHARACTER=9 val SCE_ERLANG_MACRO=10 val SCE_ERLANG_RECORD=11 val SCE_ERLANG_SEPARATOR=12 val SCE_ERLANG_NODE_NAME=13 val SCE_ERLANG_UNKNOWN=31 # Lexical states for SCLEX_OCTAVE are identical to MatLab lex Octave=SCLEX_OCTAVE SCE_MATLAB_ # Lexical states for SCLEX_MSSQL lex MSSQL=SCLEX_MSSQL SCE_MSSQL_ val SCE_MSSQL_DEFAULT=0 val SCE_MSSQL_COMMENT=1 val SCE_MSSQL_LINE_COMMENT=2 val SCE_MSSQL_NUMBER=3 val SCE_MSSQL_STRING=4 val SCE_MSSQL_OPERATOR=5 val SCE_MSSQL_IDENTIFIER=6 val SCE_MSSQL_VARIABLE=7 val SCE_MSSQL_COLUMN_NAME=8 val SCE_MSSQL_STATEMENT=9 val SCE_MSSQL_DATATYPE=10 val SCE_MSSQL_SYSTABLE=11 val SCE_MSSQL_GLOBAL_VARIABLE=12 val SCE_MSSQL_FUNCTION=13 val SCE_MSSQL_STORED_PROCEDURE=14 val SCE_MSSQL_DEFAULT_PREF_DATATYPE=15 val SCE_MSSQL_COLUMN_NAME_2=16 # Lexical states for SCLEX_VERILOG lex Verilog=SCLEX_VERILOG SCE_V_ val SCE_V_DEFAULT=0 val SCE_V_COMMENT=1 val SCE_V_COMMENTLINE=2 val SCE_V_COMMENTLINEBANG=3 val SCE_V_NUMBER=4 val SCE_V_WORD=5 val SCE_V_STRING=6 val SCE_V_WORD2=7 val SCE_V_WORD3=8 val SCE_V_PREPROCESSOR=9 val SCE_V_OPERATOR=10 val SCE_V_IDENTIFIER=11 val SCE_V_STRINGEOL=12 val SCE_V_USER=19 # Lexical states for SCLEX_KIX lex Kix=SCLEX_KIX SCE_KIX_ val SCE_KIX_DEFAULT=0 val SCE_KIX_COMMENT=1 val SCE_KIX_STRING1=2 val SCE_KIX_STRING2=3 val SCE_KIX_NUMBER=4 val SCE_KIX_VAR=5 val SCE_KIX_MACRO=6 val SCE_KIX_KEYWORD=7 val SCE_KIX_FUNCTIONS=8 val SCE_KIX_OPERATOR=9 val SCE_KIX_IDENTIFIER=31 # Lexical states for SCLEX_GUI4CLI val SCE_GC_DEFAULT=0 val SCE_GC_COMMENTLINE=1 val SCE_GC_COMMENTBLOCK=2 val SCE_GC_GLOBAL=3 val SCE_GC_EVENT=4 val SCE_GC_ATTRIBUTE=5 val SCE_GC_CONTROL=6 val SCE_GC_COMMAND=7 val SCE_GC_STRING=8 val SCE_GC_OPERATOR=9 # Lexical states for SCLEX_SPECMAN lex Specman=SCLEX_SPECMAN SCE_SN_ val SCE_SN_DEFAULT=0 val SCE_SN_CODE=1 val SCE_SN_COMMENTLINE=2 val SCE_SN_COMMENTLINEBANG=3 val SCE_SN_NUMBER=4 val SCE_SN_WORD=5 val SCE_SN_STRING=6 val SCE_SN_WORD2=7 val SCE_SN_WORD3=8 val SCE_SN_PREPROCESSOR=9 val SCE_SN_OPERATOR=10 val SCE_SN_IDENTIFIER=11 val SCE_SN_STRINGEOL=12 val SCE_SN_REGEXTAG=13 val SCE_SN_SIGNAL=14 val SCE_SN_USER=19 # Lexical states for SCLEX_AU3 lex Au3=SCLEX_AU3 SCE_AU3_ val SCE_AU3_DEFAULT=0 val SCE_AU3_COMMENT=1 val SCE_AU3_COMMENTBLOCK=2 val SCE_AU3_NUMBER=3 val SCE_AU3_FUNCTION=4 val SCE_AU3_KEYWORD=5 val SCE_AU3_MACRO=6 val SCE_AU3_STRING=7 val SCE_AU3_OPERATOR=8 val SCE_AU3_VARIABLE=9 val SCE_AU3_SENT=10 val SCE_AU3_PREPROCESSOR=11 val SCE_AU3_SPECIAL=12 val SCE_AU3_EXPAND=13 val SCE_AU3_COMOBJ=14 val SCE_AU3_UDF=15 # Lexical states for SCLEX_APDL lex APDL=SCLEX_APDL SCE_APDL_ val SCE_APDL_DEFAULT=0 val SCE_APDL_COMMENT=1 val SCE_APDL_COMMENTBLOCK=2 val SCE_APDL_NUMBER=3 val SCE_APDL_STRING=4 val SCE_APDL_OPERATOR=5 val SCE_APDL_WORD=6 val SCE_APDL_PROCESSOR=7 val SCE_APDL_COMMAND=8 val SCE_APDL_SLASHCOMMAND=9 val SCE_APDL_STARCOMMAND=10 val SCE_APDL_ARGUMENT=11 val SCE_APDL_FUNCTION=12 # Lexical states for SCLEX_BASH lex Bash=SCLEX_BASH SCE_SH_ val SCE_SH_DEFAULT=0 val SCE_SH_ERROR=1 val SCE_SH_COMMENTLINE=2 val SCE_SH_NUMBER=3 val SCE_SH_WORD=4 val SCE_SH_STRING=5 val SCE_SH_CHARACTER=6 val SCE_SH_OPERATOR=7 val SCE_SH_IDENTIFIER=8 val SCE_SH_SCALAR=9 val SCE_SH_PARAM=10 val SCE_SH_BACKTICKS=11 val SCE_SH_HERE_DELIM=12 val SCE_SH_HERE_Q=13 # Lexical states for SCLEX_ASN1 lex Asn1=SCLEX_ASN1 SCE_ASN1_ val SCE_ASN1_DEFAULT=0 val SCE_ASN1_COMMENT=1 val SCE_ASN1_IDENTIFIER=2 val SCE_ASN1_STRING=3 val SCE_ASN1_OID=4 val SCE_ASN1_SCALAR=5 val SCE_ASN1_KEYWORD=6 val SCE_ASN1_ATTRIBUTE=7 val SCE_ASN1_DESCRIPTOR=8 val SCE_ASN1_TYPE=9 val SCE_ASN1_OPERATOR=10 # Lexical states for SCLEX_VHDL lex VHDL=SCLEX_VHDL SCE_VHDL_ val SCE_VHDL_DEFAULT=0 val SCE_VHDL_COMMENT=1 val SCE_VHDL_COMMENTLINEBANG=2 val SCE_VHDL_NUMBER=3 val SCE_VHDL_STRING=4 val SCE_VHDL_OPERATOR=5 val SCE_VHDL_IDENTIFIER=6 val SCE_VHDL_STRINGEOL=7 val SCE_VHDL_KEYWORD=8 val SCE_VHDL_STDOPERATOR=9 val SCE_VHDL_ATTRIBUTE=10 val SCE_VHDL_STDFUNCTION=11 val SCE_VHDL_STDPACKAGE=12 val SCE_VHDL_STDTYPE=13 val SCE_VHDL_USERWORD=14 # Lexical states for SCLEX_CAML lex Caml=SCLEX_CAML SCE_CAML_ val SCE_CAML_DEFAULT=0 val SCE_CAML_IDENTIFIER=1 val SCE_CAML_TAGNAME=2 val SCE_CAML_KEYWORD=3 val SCE_CAML_KEYWORD2=4 val SCE_CAML_KEYWORD3=5 val SCE_CAML_LINENUM=6 val SCE_CAML_OPERATOR=7 val SCE_CAML_NUMBER=8 val SCE_CAML_CHAR=9 val SCE_CAML_STRING=11 val SCE_CAML_COMMENT=12 val SCE_CAML_COMMENT1=13 val SCE_CAML_COMMENT2=14 val SCE_CAML_COMMENT3=15 # Lexical states for SCLEX_HASKELL lex Haskell=SCLEX_HASKELL SCE_HA_ val SCE_HA_DEFAULT=0 val SCE_HA_IDENTIFIER=1 val SCE_HA_KEYWORD=2 val SCE_HA_NUMBER=3 val SCE_HA_STRING=4 val SCE_HA_CHARACTER=5 val SCE_HA_CLASS=6 val SCE_HA_MODULE=7 val SCE_HA_CAPITAL=8 val SCE_HA_DATA=9 val SCE_HA_IMPORT=10 val SCE_HA_OPERATOR=11 val SCE_HA_INSTANCE=12 val SCE_HA_COMMENTLINE=13 val SCE_HA_COMMENTBLOCK=14 val SCE_HA_COMMENTBLOCK2=15 val SCE_HA_COMMENTBLOCK3=16 # Lexical states of SCLEX_TADS3 lex TADS3=SCLEX_TADS3 SCE_T3_ val SCE_T3_DEFAULT=0 val SCE_T3_X_DEFAULT=1 val SCE_T3_PREPROCESSOR=2 val SCE_T3_BLOCK_COMMENT=3 val SCE_T3_LINE_COMMENT=4 val SCE_T3_OPERATOR=5 val SCE_T3_KEYWORD=6 val SCE_T3_NUMBER=7 val SCE_T3_IDENTIFIER=8 val SCE_T3_S_STRING=9 val SCE_T3_D_STRING=10 val SCE_T3_X_STRING=11 val SCE_T3_LIB_DIRECTIVE=12 val SCE_T3_MSG_PARAM=13 val SCE_T3_HTML_TAG=14 val SCE_T3_HTML_DEFAULT=15 val SCE_T3_HTML_STRING=16 val SCE_T3_USER1=17 val SCE_T3_USER2=18 val SCE_T3_USER3=19 val SCE_T3_BRACE=20 # Lexical states for SCLEX_REBOL lex Rebol=SCLEX_REBOL SCE_REBOL_ val SCE_REBOL_DEFAULT=0 val SCE_REBOL_COMMENTLINE=1 val SCE_REBOL_COMMENTBLOCK=2 val SCE_REBOL_PREFACE=3 val SCE_REBOL_OPERATOR=4 val SCE_REBOL_CHARACTER=5 val SCE_REBOL_QUOTEDSTRING=6 val SCE_REBOL_BRACEDSTRING=7 val SCE_REBOL_NUMBER=8 val SCE_REBOL_PAIR=9 val SCE_REBOL_TUPLE=10 val SCE_REBOL_BINARY=11 val SCE_REBOL_MONEY=12 val SCE_REBOL_ISSUE=13 val SCE_REBOL_TAG=14 val SCE_REBOL_FILE=15 val SCE_REBOL_EMAIL=16 val SCE_REBOL_URL=17 val SCE_REBOL_DATE=18 val SCE_REBOL_TIME=19 val SCE_REBOL_IDENTIFIER=20 val SCE_REBOL_WORD=21 val SCE_REBOL_WORD2=22 val SCE_REBOL_WORD3=23 val SCE_REBOL_WORD4=24 val SCE_REBOL_WORD5=25 val SCE_REBOL_WORD6=26 val SCE_REBOL_WORD7=27 val SCE_REBOL_WORD8=28 # Lexical states for SCLEX_SQL lex SQL=SCLEX_SQL SCE_SQL_ val SCE_SQL_DEFAULT=0 val SCE_SQL_COMMENT=1 val SCE_SQL_COMMENTLINE=2 val SCE_SQL_COMMENTDOC=3 val SCE_SQL_NUMBER=4 val SCE_SQL_WORD=5 val SCE_SQL_STRING=6 val SCE_SQL_CHARACTER=7 val SCE_SQL_SQLPLUS=8 val SCE_SQL_SQLPLUS_PROMPT=9 val SCE_SQL_OPERATOR=10 val SCE_SQL_IDENTIFIER=11 val SCE_SQL_SQLPLUS_COMMENT=13 val SCE_SQL_COMMENTLINEDOC=15 val SCE_SQL_WORD2=16 val SCE_SQL_COMMENTDOCKEYWORD=17 val SCE_SQL_COMMENTDOCKEYWORDERROR=18 val SCE_SQL_USER1=19 val SCE_SQL_USER2=20 val SCE_SQL_USER3=21 val SCE_SQL_USER4=22 val SCE_SQL_QUOTEDIDENTIFIER=23 # Lexical states for SCLEX_SMALLTALK lex Smalltalk=SCLEX_SMALLTALK SCE_ST_ val SCE_ST_DEFAULT=0 val SCE_ST_STRING=1 val SCE_ST_NUMBER=2 val SCE_ST_COMMENT=3 val SCE_ST_SYMBOL=4 val SCE_ST_BINARY=5 val SCE_ST_BOOL=6 val SCE_ST_SELF=7 val SCE_ST_SUPER=8 val SCE_ST_NIL=9 val SCE_ST_GLOBAL=10 val SCE_ST_RETURN=11 val SCE_ST_SPECIAL=12 val SCE_ST_KWSEND=13 val SCE_ST_ASSIGN=14 val SCE_ST_CHARACTER=15 val SCE_ST_SPEC_SEL=16 # Lexical states for SCLEX_FLAGSHIP (clipper) lex FlagShip=SCLEX_FLAGSHIP SCE_B_ val SCE_FS_DEFAULT=0 val SCE_FS_COMMENT=1 val SCE_FS_COMMENTLINE=2 val SCE_FS_COMMENTDOC=3 val SCE_FS_COMMENTLINEDOC=4 val SCE_FS_COMMENTDOCKEYWORD=5 val SCE_FS_COMMENTDOCKEYWORDERROR=6 val SCE_FS_KEYWORD=7 val SCE_FS_KEYWORD2=8 val SCE_FS_KEYWORD3=9 val SCE_FS_KEYWORD4=10 val SCE_FS_NUMBER=11 val SCE_FS_STRING=12 val SCE_FS_PREPROCESSOR=13 val SCE_FS_OPERATOR=14 val SCE_FS_IDENTIFIER=15 val SCE_FS_DATE=16 val SCE_FS_STRINGEOL=17 val SCE_FS_CONSTANT=18 val SCE_FS_ASM=19 val SCE_FS_LABEL=20 val SCE_FS_ERROR=21 val SCE_FS_HEXNUMBER=22 val SCE_FS_BINNUMBER=23 # Lexical states for SCLEX_CSOUND lex Csound=SCLEX_CSOUND SCE_CSOUND_ val SCE_CSOUND_DEFAULT=0 val SCE_CSOUND_COMMENT=1 val SCE_CSOUND_NUMBER=2 val SCE_CSOUND_OPERATOR=3 val SCE_CSOUND_INSTR=4 val SCE_CSOUND_IDENTIFIER=5 val SCE_CSOUND_OPCODE=6 val SCE_CSOUND_HEADERSTMT=7 val SCE_CSOUND_USERKEYWORD=8 val SCE_CSOUND_COMMENTBLOCK=9 val SCE_CSOUND_PARAM=10 val SCE_CSOUND_ARATE_VAR=11 val SCE_CSOUND_KRATE_VAR=12 val SCE_CSOUND_IRATE_VAR=13 val SCE_CSOUND_GLOBAL_VAR=14 val SCE_CSOUND_STRINGEOL=15 # Lexical states for SCLEX_INNOSETUP lex Inno=SCLEX_INNOSETUP SCE_INNO_ val SCE_INNO_DEFAULT=0 val SCE_INNO_COMMENT=1 val SCE_INNO_KEYWORD=2 val SCE_INNO_PARAMETER=3 val SCE_INNO_SECTION=4 val SCE_INNO_PREPROC=5 val SCE_INNO_PREPROC_INLINE=6 val SCE_INNO_COMMENT_PASCAL=7 val SCE_INNO_KEYWORD_PASCAL=8 val SCE_INNO_KEYWORD_USER=9 val SCE_INNO_STRING_DOUBLE=10 val SCE_INNO_STRING_SINGLE=11 val SCE_INNO_IDENTIFIER=12 # Lexical states for SCLEX_OPAL lex Opal=SCLEX_OPAL SCE_OPAL_ val SCE_OPAL_SPACE=0 val SCE_OPAL_COMMENT_BLOCK=1 val SCE_OPAL_COMMENT_LINE=2 val SCE_OPAL_INTEGER=3 val SCE_OPAL_KEYWORD=4 val SCE_OPAL_SORT=5 val SCE_OPAL_STRING=6 val SCE_OPAL_PAR=7 val SCE_OPAL_BOOL_CONST=8 val SCE_OPAL_DEFAULT=32 # Lexical states for SCLEX_SPICE lex Spice=SCLEX_SPICE SCE_SPICE_ val SCE_SPICE_DEFAULT=0 val SCE_SPICE_IDENTIFIER=1 val SCE_SPICE_KEYWORD=2 val SCE_SPICE_KEYWORD2=3 val SCE_SPICE_KEYWORD3=4 val SCE_SPICE_NUMBER=5 val SCE_SPICE_DELIMITER=6 val SCE_SPICE_VALUE=7 val SCE_SPICE_COMMENTLINE=8 # Lexical states for SCLEX_CMAKE lex CMAKE=SCLEX_CMAKE SCE_CMAKE_ val SCE_CMAKE_DEFAULT=0 val SCE_CMAKE_COMMENT=1 val SCE_CMAKE_STRINGDQ=2 val SCE_CMAKE_STRINGLQ=3 val SCE_CMAKE_STRINGRQ=4 val SCE_CMAKE_COMMANDS=5 val SCE_CMAKE_PARAMETERS=6 val SCE_CMAKE_VARIABLE=7 val SCE_CMAKE_USERDEFINED=8 val SCE_CMAKE_WHILEDEF=9 val SCE_CMAKE_FOREACHDEF=10 val SCE_CMAKE_IFDEFINEDEF=11 val SCE_CMAKE_MACRODEF=12 val SCE_CMAKE_STRINGVAR=13 val SCE_CMAKE_NUMBER=14 # Lexical states for SCLEX_GAP lex Gap=SCLEX_GAP SCE_GAP_ val SCE_GAP_DEFAULT=0 val SCE_GAP_IDENTIFIER=1 val SCE_GAP_KEYWORD=2 val SCE_GAP_KEYWORD2=3 val SCE_GAP_KEYWORD3=4 val SCE_GAP_KEYWORD4=5 val SCE_GAP_STRING=6 val SCE_GAP_CHAR=7 val SCE_GAP_OPERATOR=8 val SCE_GAP_COMMENT=9 val SCE_GAP_NUMBER=10 val SCE_GAP_STRINGEOL=11 # Lexical state for SCLEX_PLM lex PLM=SCLEX_PLM SCE_PLM_ val SCE_PLM_DEFAULT=0 val SCE_PLM_COMMENT=1 val SCE_PLM_STRING=2 val SCE_PLM_NUMBER=3 val SCE_PLM_IDENTIFIER=4 val SCE_PLM_OPERATOR=5 val SCE_PLM_CONTROL=6 val SCE_PLM_KEYWORD=7 lex Progress=SCLEX_PROGRESS SCE_4GL_ val SCE_4GL_DEFAULT=0 val SCE_4GL_NUMBER=1 val SCE_4GL_WORD=2 val SCE_4GL_STRING=3 val SCE_4GL_CHARACTER=4 val SCE_4GL_PREPROCESSOR=5 val SCE_4GL_OPERATOR=6 val SCE_4GL_IDENTIFIER=7 val SCE_4GL_BLOCK=8 val SCE_4GL_END=9 val SCE_4GL_COMMENT1=10 val SCE_4GL_COMMENT2=11 val SCE_4GL_COMMENT3=12 val SCE_4GL_COMMENT4=13 val SCE_4GL_COMMENT5=14 val SCE_4GL_COMMENT6=15 val SCE_4GL_DEFAULT_=16 val SCE_4GL_NUMBER_=17 val SCE_4GL_WORD_=18 val SCE_4GL_STRING_=19 val SCE_4GL_CHARACTER_=20 val SCE_4GL_PREPROCESSOR_=21 val SCE_4GL_OPERATOR_=22 val SCE_4GL_IDENTIFIER_=23 val SCE_4GL_BLOCK_=24 val SCE_4GL_END_=25 val SCE_4GL_COMMENT1_=26 val SCE_4GL_COMMENT2_=27 val SCE_4GL_COMMENT3_=28 val SCE_4GL_COMMENT4_=29 val SCE_4GL_COMMENT5_=30 val SCE_4GL_COMMENT6_=31 # Events evt void StyleNeeded=2000(int position) evt void CharAdded=2001(int ch) evt void SavePointReached=2002(void) evt void SavePointLeft=2003(void) evt void ModifyAttemptRO=2004(void) # GTK+ Specific to work around focus and accelerator problems: evt void Key=2005(int ch, int modifiers) evt void DoubleClick=2006(void) evt void UpdateUI=2007(void) evt void Modified=2008(int position, int modificationType, string text, int length, int linesAdded, int line, int foldLevelNow, int foldLevelPrev) evt void MacroRecord=2009(int message, int wParam, int lParam) evt void MarginClick=2010(int modifiers, int position, int margin) evt void NeedShown=2011(int position, int length) evt void Painted=2013(void) evt void UserListSelection=2014(int listType, string text) evt void URIDropped=2015(string text) evt void DwellStart=2016(int position) evt void DwellEnd=2017(int position) evt void Zoom=2018(void) evt void HotSpotClick=2019(int modifiers, int position) evt void HotSpotDoubleClick=2020(int modifiers, int position) evt void CallTipClick=2021(int position) evt void AutoCSelection=2022(string text) evt void IndicatorClick=2023(int modifiers, int position) evt void IndicatorRelease=2024(int modifiers, int position) cat Deprecated # CARET_POLICY changed in 1.47 fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop) val CARET_CENTER=0x02 val CARET_XEVEN=0x08 val CARET_XJUMPS=0x10 # The old name for SCN_UPDATEUI val SCN_CHECKBRACE=2007 evt void PosChanged=2012(int position) # SCLEX_HTML should be used in preference to these. val SCLEX_ASP=29 val SCLEX_PHP=30 sqliteman-1.2.2/sqliteman/qscintilla2/CMakeLists.txt0000644000175000001440000001102511407213302022073 0ustar subzerousers# Warning: all lexers compilation and building is mandatory for successful linking! INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/sqliteman/qscintilla2/include ${CMAKE_SOURCE_DIR}/sqliteman/qscintilla2/src ${CMAKE_SOURCE_DIR}/sqliteman/qscintilla2/Qt4 ${CMAKE_SOURCE_DIR}/sqliteman/qscintilla2/Qt4/Qci ) ADD_DEFINITIONS("-DQT") ADD_DEFINITIONS("-DSCI_LEXER") SET(TORA_QSCINTILLA2_MOC_CLASSES Qt4/Qsci/qsciapis.h # Qt4/Qsci/qscicommand.h # Qt4/Qsci/qscicommandset.h # Qt4/Qsci/qscidocument.h # Qt4/Qsci/qsciglobal.h Qt4/Qsci/qscilexer.h Qt4/Qsci/qscilexerbash.h Qt4/Qsci/qscilexerbatch.h Qt4/Qsci/qscilexercmake.h Qt4/Qsci/qscilexercpp.h Qt4/Qsci/qscilexercsharp.h Qt4/Qsci/qscilexercss.h Qt4/Qsci/qscilexerd.h Qt4/Qsci/qscilexerdiff.h Qt4/Qsci/qscilexerhtml.h Qt4/Qsci/qscilexeridl.h Qt4/Qsci/qscilexerjava.h Qt4/Qsci/qscilexerjavascript.h Qt4/Qsci/qscilexerlua.h Qt4/Qsci/qscilexermakefile.h Qt4/Qsci/qscilexerperl.h Qt4/Qsci/qscilexerpov.h Qt4/Qsci/qscilexerproperties.h Qt4/Qsci/qscilexerpython.h Qt4/Qsci/qscilexerruby.h Qt4/Qsci/qscilexersql.h Qt4/Qsci/qscilexertex.h Qt4/Qsci/qscilexervhdl.h Qt4/Qsci/qscimacro.h # Qt4/Qsci/qsciprinter.h Qt4/Qsci/qsciscintilla.h Qt4/Qsci/qsciscintillabase.h # Qt4/ListBoxQt.h Qt4/SciClasses.h # Qt4/ScintillaQt.h ) SET(TORA_QSCINTILLA2_LIB_SOURCES include/Accessor.h include/Face.py include/HFacer.py include/KeyWords.h include/License.txt include/Platform.h include/PropSet.h include/SString.h include/SciLexer.h include/Scintilla.h include/Scintilla.iface include/ScintillaWidget.h include/WindowAccessor.h Qt4/ListBoxQt.cpp Qt4/ListBoxQt.h Qt4/PlatQt.cpp Qt4/SciClasses.cpp Qt4/SciClasses.h Qt4/ScintillaQt.cpp Qt4/ScintillaQt.h Qt4/qsciapis.cpp Qt4/qscicommand.cpp Qt4/qscicommandset.cpp Qt4/qscidocument.cpp Qt4/qscilexer.cpp Qt4/qscilexerbash.cpp Qt4/qscilexerbatch.cpp Qt4/qscilexercmake.cpp Qt4/qscilexercpp.cpp Qt4/qscilexercsharp.cpp Qt4/qscilexercss.cpp Qt4/qscilexerd.cpp Qt4/qscilexerdiff.cpp Qt4/qscilexerhtml.cpp Qt4/qscilexeridl.cpp Qt4/qscilexerjava.cpp Qt4/qscilexerjavascript.cpp Qt4/qscilexerlua.cpp Qt4/qscilexermakefile.cpp Qt4/qscilexerperl.cpp Qt4/qscilexerpov.cpp Qt4/qscilexerproperties.cpp Qt4/qscilexerpython.cpp Qt4/qscilexerruby.cpp Qt4/qscilexersql.cpp Qt4/qscilexertex.cpp Qt4/qscilexervhdl.cpp Qt4/qscimacro.cpp Qt4/qsciprinter.cpp Qt4/qsciscintilla.cpp Qt4/qsciscintillabase.cpp src/AutoComplete.cpp src/AutoComplete.h src/CallTip.cpp src/CallTip.h src/CellBuffer.cpp src/CellBuffer.h src/CharClassify.cpp src/CharClassify.h src/CharacterSet.h src/ContractionState.cpp src/ContractionState.h src/Decoration.cpp src/Decoration.h src/Document.cpp src/Document.h src/DocumentAccessor.cpp src/DocumentAccessor.h src/Editor.cpp src/Editor.h src/ExternalLexer.cpp src/ExternalLexer.h src/Indicator.cpp src/Indicator.h src/KeyMap.cpp src/KeyMap.h src/KeyWords.cpp src/LexAPDL.cpp src/LexAU3.cpp src/LexAVE.cpp src/LexAda.cpp src/LexAsm.cpp src/LexAsn1.cpp src/LexBaan.cpp src/LexBash.cpp src/LexBasic.cpp src/LexBullant.cpp src/LexCLW.cpp src/LexCPP.cpp src/LexCSS.cpp src/LexCaml.cpp src/LexCmake.cpp src/LexConf.cpp src/LexCrontab.cpp src/LexCsound.cpp src/LexD.cpp src/LexEScript.cpp src/LexEiffel.cpp src/LexErlang.cpp src/LexFlagship.cpp src/LexForth.cpp src/LexFortran.cpp src/LexGAP.cpp src/LexGen.py src/LexGui4Cli.cpp src/LexHTML.cpp src/LexHaskell.cpp src/LexInno.cpp src/LexKix.cpp src/LexLisp.cpp src/LexLout.cpp src/LexLua.cpp src/LexMMIXAL.cpp src/LexMPT.cpp src/LexMSSQL.cpp src/LexMatlab.cpp src/LexMetapost.cpp src/LexNsis.cpp src/LexOpal.cpp src/LexOthers.cpp src/LexPB.cpp src/LexPLM.cpp src/LexPOV.cpp src/LexPS.cpp src/LexPascal.cpp src/LexPerl.cpp src/LexProgress.cpp src/LexPython.cpp src/LexRebol.cpp src/LexRuby.cpp src/LexSQL.cpp src/LexScriptol.cpp src/LexSmalltalk.cpp src/LexSpecman.cpp src/LexSpice.cpp src/LexTADS3.cpp src/LexTCL.cpp src/LexTeX.cpp src/LexVB.cpp src/LexVHDL.cpp src/LexVerilog.cpp src/LexYAML.cpp src/License.txt src/LineMarker.cpp src/LineMarker.h src/Partitioning.h src/PositionCache.cpp src/PositionCache.h src/PropSet.cpp src/RESearch.cpp src/RESearch.h src/RunStyles.cpp src/RunStyles.h src/SVector.h src/SciTE.properties src/ScintillaBase.cpp src/ScintillaBase.h src/SplitVector.h src/Style.cpp src/Style.h src/StyleContext.cpp src/StyleContext.h src/UniConversion.cpp src/UniConversion.h src/ViewStyle.cpp src/ViewStyle.h src/WindowAccessor.cpp src/XPM.cpp src/XPM.h ) QT4_WRAP_CPP(TORA_QSCINTILLA2_MOC_SOURCES ${TORA_QSCINTILLA2_MOC_CLASSES}) SET(TORA_QSCINTILLA2_LIB "tora_qscintilla2_lib") ADD_LIBRARY(${TORA_QSCINTILLA2_LIB} STATIC ${TORA_QSCINTILLA2_LIB_SOURCES} ${TORA_QSCINTILLA2_MOC_SOURCES}) sqliteman-1.2.2/sqliteman/qscintilla2/src/0000755000175000001440000000000011407213302020123 5ustar subzerouserssqliteman-1.2.2/sqliteman/qscintilla2/src/LexNsis.cpp0000644000175000001440000004375111407213302022226 0ustar subzerousers// Scintilla source code edit control /** @file LexNsis.cxx ** Lexer for NSIS **/ // Copyright 2003 - 2005 by Angelo Mandato // Last Updated: 03/13/2005 // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif /* // located in SciLexer.h #define SCLEX_NSIS 43 #define SCE_NSIS_DEFAULT 0 #define SCE_NSIS_COMMENT 1 #define SCE_NSIS_STRINGDQ 2 #define SCE_NSIS_STRINGLQ 3 #define SCE_NSIS_STRINGRQ 4 #define SCE_NSIS_FUNCTION 5 #define SCE_NSIS_VARIABLE 6 #define SCE_NSIS_LABEL 7 #define SCE_NSIS_USERDEFINED 8 #define SCE_NSIS_SECTIONDEF 9 #define SCE_NSIS_SUBSECTIONDEF 10 #define SCE_NSIS_IFDEFINEDEF 11 #define SCE_NSIS_MACRODEF 12 #define SCE_NSIS_STRINGVAR 13 #define SCE_NSIS_NUMBER 14 // ADDED for Scintilla v1.63 #define SCE_NSIS_SECTIONGROUP 15 #define SCE_NSIS_PAGEEX 16 #define SCE_NSIS_FUNCTIONDEF 17 #define SCE_NSIS_COMMENTBOX 18 */ static bool isNsisNumber(char ch) { return (ch >= '0' && ch <= '9'); } static bool isNsisChar(char ch) { return (ch == '.' ) || (ch == '_' ) || isNsisNumber(ch) || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } static bool isNsisLetter(char ch) { return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler) { int nNextLine = -1; for( unsigned int i = start; i < end; i++ ) { char cNext = styler.SafeGetCharAt( i ); if( cNext == '\n' ) { nNextLine = i+1; break; } } if( nNextLine == -1 ) // We never foudn the next line... return false; for( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) { char cNext = styler.SafeGetCharAt( firstChar ); if( cNext == ' ' ) continue; if( cNext == '\t' ) continue; if( cNext == '!' ) { if( styler.Match(firstChar, "!else") ) return true; } break; } return false; } static int NsisCmp( char *s1, char *s2, bool bIgnoreCase ) { if( bIgnoreCase ) return CompareCaseInsensitive( s1, s2); return strcmp( s1, s2 ); } static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd ) { int style = styler.StyleAt(end); // If the word is too long, it is not what we are looking for if( end - start > 20 ) return foldlevel; if( foldUtilityCmd ) { // Check the style at this point, if it is not valid, then return zero if( style != SCE_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF && style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_IFDEFINEDEF && style != SCE_NSIS_MACRODEF && style != SCE_NSIS_SECTIONGROUP && style != SCE_NSIS_PAGEEX ) return foldlevel; } else { if( style != SCE_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF && style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_SECTIONGROUP && style != SCE_NSIS_PAGEEX ) return foldlevel; } int newFoldlevel = foldlevel; bool bIgnoreCase = false; if( styler.GetPropertyInt("nsis.ignorecase") == 1 ) bIgnoreCase = true; char s[20]; // The key word we are looking for has atmost 13 characters for (unsigned int i = 0; i < end - start + 1 && i < 19; i++) { s[i] = static_cast( styler[ start + i ] ); s[i + 1] = '\0'; } if( s[0] == '!' ) { if( NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!macro", bIgnoreCase ) == 0 ) newFoldlevel++; else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 ) newFoldlevel--; else if( bElse && NsisCmp(s, "!else", bIgnoreCase) == 0 ) newFoldlevel++; } else { if( NsisCmp(s, "Section", bIgnoreCase ) == 0 || NsisCmp(s, "SectionGroup", bIgnoreCase ) == 0 || NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "SubSection", bIgnoreCase ) == 0 || NsisCmp(s, "PageEx", bIgnoreCase ) == 0 ) newFoldlevel++; else if( NsisCmp(s, "SectionGroupEnd", bIgnoreCase ) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase ) == 0 ) newFoldlevel--; } return newFoldlevel; } static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler ) { bool bIgnoreCase = false; if( styler.GetPropertyInt("nsis.ignorecase") == 1 ) bIgnoreCase = true; bool bUserVars = false; if( styler.GetPropertyInt("nsis.uservars") == 1 ) bUserVars = true; char s[100]; WordList &Functions = *keywordLists[0]; WordList &Variables = *keywordLists[1]; WordList &Lables = *keywordLists[2]; WordList &UserDefined = *keywordLists[3]; for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) { if( bIgnoreCase ) s[i] = static_cast( tolower(styler[ start + i ] ) ); else s[i] = static_cast( styler[ start + i ] ); s[i + 1] = '\0'; } // Check for special words... if( NsisCmp(s, "!macro", bIgnoreCase ) == 0 || NsisCmp(s, "!macroend", bIgnoreCase) == 0 ) // Covers !micro and !microend return SCE_NSIS_MACRODEF; if( NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 ) return SCE_NSIS_IFDEFINEDEF; if( NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 ) return SCE_NSIS_IFDEFINEDEF; if( NsisCmp(s, "!if", bIgnoreCase ) == 0 ) return SCE_NSIS_IFDEFINEDEF; if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd return SCE_NSIS_SECTIONGROUP; if( NsisCmp(s, "Section", bIgnoreCase ) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase) == 0 ) // Covers Section and SectionEnd return SCE_NSIS_SECTIONDEF; if( NsisCmp(s, "SubSection", bIgnoreCase) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase) == 0 ) // Covers SubSection and SubSectionEnd return SCE_NSIS_SUBSECTIONDEF; if( NsisCmp(s, "PageEx", bIgnoreCase) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase) == 0 ) // Covers PageEx and PageExEnd return SCE_NSIS_PAGEEX; if( NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 ) // Covers Function and FunctionEnd return SCE_NSIS_FUNCTIONDEF; if ( Functions.InList(s) ) return SCE_NSIS_FUNCTION; if ( Variables.InList(s) ) return SCE_NSIS_VARIABLE; if ( Lables.InList(s) ) return SCE_NSIS_LABEL; if( UserDefined.InList(s) ) return SCE_NSIS_USERDEFINED; if( strlen(s) > 3 ) { if( s[1] == '{' && s[strlen(s)-1] == '}' ) return SCE_NSIS_VARIABLE; } // See if the variable is a user defined variable if( s[0] == '$' && bUserVars ) { bool bHasSimpleNsisChars = true; for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) { if( !isNsisChar( s[j] ) ) { bHasSimpleNsisChars = false; break; } } if( bHasSimpleNsisChars ) return SCE_NSIS_VARIABLE; } // To check for numbers if( isNsisNumber( s[0] ) ) { bool bHasSimpleNsisNumber = true; for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) { if( !isNsisNumber( s[j] ) ) { bHasSimpleNsisNumber = false; break; } } if( bHasSimpleNsisNumber ) return SCE_NSIS_NUMBER; } return SCE_NSIS_DEFAULT; } static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) { int state = SCE_NSIS_DEFAULT; if( startPos > 0 ) state = styler.StyleAt(startPos-1); // Use the style from the previous line, usually default, but could be commentbox styler.StartAt( startPos ); styler.GetLine( startPos ); unsigned int nLengthDoc = startPos + length; styler.StartSegment( startPos ); char cCurrChar; bool bVarInString = false; bool bClassicVarInString = false; unsigned int i; for( i = startPos; i < nLengthDoc; i++ ) { cCurrChar = styler.SafeGetCharAt( i ); char cNextChar = styler.SafeGetCharAt(i+1); switch(state) { case SCE_NSIS_DEFAULT: if( cCurrChar == ';' || cCurrChar == '#' ) // we have a comment line { styler.ColourTo(i-1, state ); state = SCE_NSIS_COMMENT; break; } if( cCurrChar == '"' ) { styler.ColourTo(i-1, state ); state = SCE_NSIS_STRINGDQ; bVarInString = false; bClassicVarInString = false; break; } if( cCurrChar == '\'' ) { styler.ColourTo(i-1, state ); state = SCE_NSIS_STRINGRQ; bVarInString = false; bClassicVarInString = false; break; } if( cCurrChar == '`' ) { styler.ColourTo(i-1, state ); state = SCE_NSIS_STRINGLQ; bVarInString = false; bClassicVarInString = false; break; } // NSIS KeyWord,Function, Variable, UserDefined: if( cCurrChar == '$' || isNsisChar(cCurrChar) || cCurrChar == '!' ) { styler.ColourTo(i-1,state); state = SCE_NSIS_FUNCTION; // If it is a number, we must check and set style here first... if( isNsisNumber(cCurrChar) && (cNextChar == '\t' || cNextChar == ' ' || cNextChar == '\r' || cNextChar == '\n' ) ) styler.ColourTo( i, SCE_NSIS_NUMBER); break; } if( cCurrChar == '/' && cNextChar == '*' ) { styler.ColourTo(i-1,state); state = SCE_NSIS_COMMENTBOX; break; } break; case SCE_NSIS_COMMENT: if( cNextChar == '\n' || cNextChar == '\r' ) { // Special case: if( cCurrChar == '\\' ) { styler.ColourTo(i-2,state); styler.ColourTo(i,SCE_NSIS_DEFAULT); } else { styler.ColourTo(i,state); state = SCE_NSIS_DEFAULT; } } break; case SCE_NSIS_STRINGDQ: case SCE_NSIS_STRINGLQ: case SCE_NSIS_STRINGRQ: if( styler.SafeGetCharAt(i-1) == '\\' && styler.SafeGetCharAt(i-2) == '$' ) break; // Ignore the next character, even if it is a quote of some sort if( cCurrChar == '"' && state == SCE_NSIS_STRINGDQ ) { styler.ColourTo(i,state); state = SCE_NSIS_DEFAULT; break; } if( cCurrChar == '`' && state == SCE_NSIS_STRINGLQ ) { styler.ColourTo(i,state); state = SCE_NSIS_DEFAULT; break; } if( cCurrChar == '\'' && state == SCE_NSIS_STRINGRQ ) { styler.ColourTo(i,state); state = SCE_NSIS_DEFAULT; break; } if( cNextChar == '\r' || cNextChar == '\n' ) { int nCurLine = styler.GetLine(i+1); int nBack = i; // We need to check if the previous line has a \ in it... bool bNextLine = false; while( nBack > 0 ) { if( styler.GetLine(nBack) != nCurLine ) break; char cTemp = styler.SafeGetCharAt(nBack, 'a'); // Letter 'a' is safe here if( cTemp == '\\' ) { bNextLine = true; break; } if( cTemp != '\r' && cTemp != '\n' && cTemp != '\t' && cTemp != ' ' ) break; nBack--; } if( bNextLine ) { styler.ColourTo(i+1,state); } if( bNextLine == false ) { styler.ColourTo(i,state); state = SCE_NSIS_DEFAULT; } } break; case SCE_NSIS_FUNCTION: // NSIS KeyWord: if( cCurrChar == '$' ) state = SCE_NSIS_DEFAULT; else if( cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) ) state = SCE_NSIS_DEFAULT; else if( (isNsisChar(cCurrChar) && !isNsisChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' ) { state = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler ); styler.ColourTo( i, state); state = SCE_NSIS_DEFAULT; } else if( !isNsisChar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' ) { if( classifyWordNsis( styler.GetStartSegment(), i-1, keywordLists, styler) == SCE_NSIS_NUMBER ) styler.ColourTo( i-1, SCE_NSIS_NUMBER ); state = SCE_NSIS_DEFAULT; if( cCurrChar == '"' ) { state = SCE_NSIS_STRINGDQ; bVarInString = false; bClassicVarInString = false; } else if( cCurrChar == '`' ) { state = SCE_NSIS_STRINGLQ; bVarInString = false; bClassicVarInString = false; } else if( cCurrChar == '\'' ) { state = SCE_NSIS_STRINGRQ; bVarInString = false; bClassicVarInString = false; } else if( cCurrChar == '#' || cCurrChar == ';' ) { state = SCE_NSIS_COMMENT; } } break; case SCE_NSIS_COMMENTBOX: if( styler.SafeGetCharAt(i-1) == '*' && cCurrChar == '/' ) { styler.ColourTo(i,state); state = SCE_NSIS_DEFAULT; } break; } if( state == SCE_NSIS_COMMENT || state == SCE_NSIS_COMMENTBOX ) { styler.ColourTo(i,state); } else if( state == SCE_NSIS_STRINGDQ || state == SCE_NSIS_STRINGLQ || state == SCE_NSIS_STRINGRQ ) { bool bIngoreNextDollarSign = false; bool bUserVars = false; if( styler.GetPropertyInt("nsis.uservars") == 1 ) bUserVars = true; if( bVarInString && cCurrChar == '$' ) { bVarInString = false; bIngoreNextDollarSign = true; } else if( bVarInString && cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' || cNextChar == '"' || cNextChar == '`' || cNextChar == '\'' ) ) { styler.ColourTo( i+1, SCE_NSIS_STRINGVAR); bVarInString = false; bIngoreNextDollarSign = false; } // Covers "$INSTDIR and user vars like $MYVAR" else if( bVarInString && !isNsisChar(cNextChar) ) { int nWordState = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler); if( nWordState == SCE_NSIS_VARIABLE ) styler.ColourTo( i, SCE_NSIS_STRINGVAR); else if( bUserVars ) styler.ColourTo( i, SCE_NSIS_STRINGVAR); bVarInString = false; } // Covers "${TEST}..." else if( bClassicVarInString && cNextChar == '}' ) { styler.ColourTo( i+1, SCE_NSIS_STRINGVAR); bClassicVarInString = false; } // Start of var in string if( !bIngoreNextDollarSign && cCurrChar == '$' && cNextChar == '{' ) { styler.ColourTo( i-1, state); bClassicVarInString = true; bVarInString = false; } else if( !bIngoreNextDollarSign && cCurrChar == '$' ) { styler.ColourTo( i-1, state); bVarInString = true; bClassicVarInString = false; } } } // Colourise remaining document styler.ColourTo(nLengthDoc-1,state); } static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { // No folding enabled, no reason to continue... if( styler.GetPropertyInt("fold") == 0 ) return; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1; bool foldUtilityCmd = styler.GetPropertyInt("nsis.foldutilcmd", 1) == 1; bool blockComment = false; int lineCurrent = styler.GetLine(startPos); unsigned int safeStartPos = styler.LineStart( lineCurrent ); bool bArg1 = true; int nWordStart = -1; int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelNext = levelCurrent; int style = styler.StyleAt(safeStartPos); if( style == SCE_NSIS_COMMENTBOX ) { if( styler.SafeGetCharAt(safeStartPos) == '/' && styler.SafeGetCharAt(safeStartPos+1) == '*' ) levelNext++; blockComment = true; } for (unsigned int i = safeStartPos; i < startPos + length; i++) { char chCurr = styler.SafeGetCharAt(i); style = styler.StyleAt(i); if( blockComment && style != SCE_NSIS_COMMENTBOX ) { levelNext--; blockComment = false; } else if( !blockComment && style == SCE_NSIS_COMMENTBOX ) { levelNext++; blockComment = true; } if( bArg1 && !blockComment) { if( nWordStart == -1 && (isNsisLetter(chCurr) || chCurr == '!') ) { nWordStart = i; } else if( isNsisLetter(chCurr) == false && nWordStart > -1 ) { int newLevel = calculateFoldNsis( nWordStart, i-1, levelNext, styler, foldAtElse, foldUtilityCmd ); if( newLevel == levelNext ) { if( foldAtElse && foldUtilityCmd ) { if( NsisNextLineHasElse(i, startPos + length, styler) ) levelNext--; } } else levelNext = newLevel; bArg1 = false; } } if( chCurr == '\n' ) { if( bArg1 && foldAtElse && foldUtilityCmd && !blockComment ) { if( NsisNextLineHasElse(i, startPos + length, styler) ) levelNext--; } // If we are on a new line... int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (levelUse < levelNext ) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) styler.SetLevel(lineCurrent, lev); lineCurrent++; levelCurrent = levelNext; bArg1 = true; // New line, lets look at first argument again nWordStart = -1; } } int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) styler.SetLevel(lineCurrent, lev); } static const char * const nsisWordLists[] = { "Functions", "Variables", "Lables", "UserDefined", 0, }; LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists); sqliteman-1.2.2/sqliteman/qscintilla2/src/DocumentAccessor.cpp0000644000175000001440000001176311407213302024100 0ustar subzerousers// Scintilla source code edit control /** @file DocumentAccessor.cxx ** Rapid easy access to contents of a Scintilla. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "SVector.h" #include "Accessor.h" #include "DocumentAccessor.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" #include "CellBuffer.h" #include "Scintilla.h" #include "CharClassify.h" #include "Decoration.h" #include "Document.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif DocumentAccessor::~DocumentAccessor() { } bool DocumentAccessor::InternalIsLeadByte(char ch) { if (SC_CP_UTF8 == codePage) // For lexing, all characters >= 0x80 are treated the // same so none is considered a lead byte. return false; else return Platform::IsDBCSLeadByte(codePage, ch); } void DocumentAccessor::Fill(int position) { if (lenDoc == -1) lenDoc = pdoc->Length(); startPos = position - slopSize; if (startPos + bufferSize > lenDoc) startPos = lenDoc - bufferSize; if (startPos < 0) startPos = 0; endPos = startPos + bufferSize; if (endPos > lenDoc) endPos = lenDoc; pdoc->GetCharRange(buf, startPos, endPos-startPos); buf[endPos-startPos] = '\0'; } bool DocumentAccessor::Match(int pos, const char *s) { for (int i=0; *s; i++) { if (*s != SafeGetCharAt(pos+i)) return false; s++; } return true; } char DocumentAccessor::StyleAt(int position) { // Mask off all bits which aren't in the 'mask'. return static_cast(pdoc->StyleAt(position) & mask); } int DocumentAccessor::GetLine(int position) { return pdoc->LineFromPosition(position); } int DocumentAccessor::LineStart(int line) { return pdoc->LineStart(line); } int DocumentAccessor::LevelAt(int line) { return pdoc->GetLevel(line); } int DocumentAccessor::Length() { if (lenDoc == -1) lenDoc = pdoc->Length(); return lenDoc; } int DocumentAccessor::GetLineState(int line) { return pdoc->GetLineState(line); } int DocumentAccessor::SetLineState(int line, int state) { return pdoc->SetLineState(line, state); } void DocumentAccessor::StartAt(unsigned int start, char chMask) { // Store the mask specified for use with StyleAt. mask = chMask; pdoc->StartStyling(start, chMask); startPosStyling = start; } void DocumentAccessor::StartSegment(unsigned int pos) { startSeg = pos; } void DocumentAccessor::ColourTo(unsigned int pos, int chAttr) { // Only perform styling if non empty range if (pos != startSeg - 1) { PLATFORM_ASSERT(pos >= startSeg); if (pos < startSeg) { return; } if (validLen + (pos - startSeg + 1) >= bufferSize) Flush(); if (validLen + (pos - startSeg + 1) >= bufferSize) { // Too big for buffer so send directly pdoc->SetStyleFor(pos - startSeg + 1, static_cast(chAttr)); } else { if (chAttr != chWhile) chFlags = 0; chAttr |= chFlags; for (unsigned int i = startSeg; i <= pos; i++) { PLATFORM_ASSERT((startPosStyling + validLen) < Length()); styleBuf[validLen++] = static_cast(chAttr); } } } startSeg = pos+1; } void DocumentAccessor::SetLevel(int line, int level) { pdoc->SetLevel(line, level); } void DocumentAccessor::Flush() { startPos = extremePosition; lenDoc = -1; if (validLen > 0) { pdoc->SetStyles(validLen, styleBuf); startPosStyling += validLen; validLen = 0; } } int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { int end = Length(); int spaceFlags = 0; // Determines the indentation level of the current line and also checks for consistent // indentation compared to the previous line. // Indentation is judged consistent when the indentation whitespace of each line lines // the same or the indentation of one line is a prefix of the other. int pos = LineStart(line); char ch = (*this)[pos]; int indent = 0; bool inPrevPrefix = line > 0; int posPrev = inPrevPrefix ? LineStart(line-1) : 0; while ((ch == ' ' || ch == '\t') && (pos < end)) { if (inPrevPrefix) { char chPrev = (*this)[posPrev++]; if (chPrev == ' ' || chPrev == '\t') { if (chPrev != ch) spaceFlags |= wsInconsistent; } else { inPrevPrefix = false; } } if (ch == ' ') { spaceFlags |= wsSpace; indent++; } else { // Tab spaceFlags |= wsTab; if (spaceFlags & wsSpace) spaceFlags |= wsSpaceTab; indent = (indent / 8 + 1) * 8; } ch = (*this)[++pos]; } *flags = spaceFlags; indent += SC_FOLDLEVELBASE; // if completely empty line or the start of a comment... if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) return indent | SC_FOLDLEVELWHITEFLAG; else return indent; } void DocumentAccessor::IndicatorFill(int start, int end, int indicator, int value) { pdoc->decorations.SetCurrentIndicator(indicator); pdoc->DecorationFillRange(start, value, end - start); } sqliteman-1.2.2/sqliteman/qscintilla2/src/LexEiffel.cpp0000644000175000001440000001645511407213302022505 0ustar subzerousers// Scintilla source code edit control /** @file LexEiffel.cxx ** Lexer for Eiffel. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static inline bool isEiffelOperator(unsigned int ch) { // '.' left out as it is used to make up numbers return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '{' || ch == '}' || ch == '~' || ch == '[' || ch == ']' || ch == ';' || ch == '<' || ch == '>' || ch == ',' || ch == '.' || ch == '^' || ch == '%' || ch == ':' || ch == '!' || ch == '@' || ch == '?'; } static inline bool IsAWordChar(unsigned int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static inline bool IsAWordStart(unsigned int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static void ColouriseEiffelDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.state == SCE_EIFFEL_STRINGEOL) { if (sc.ch != '\r' && sc.ch != '\n') { sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_OPERATOR) { sc.SetState(SCE_EIFFEL_DEFAULT); } else if (sc.state == SCE_EIFFEL_WORD) { if (!IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (!keywords.InList(s)) { sc.ChangeState(SCE_EIFFEL_IDENTIFIER); } sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_NUMBER) { if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_COMMENTLINE) { if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_STRING) { if (sc.ch == '%') { sc.Forward(); } else if (sc.ch == '\"') { sc.Forward(); sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_CHARACTER) { if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_EIFFEL_STRINGEOL); } else if (sc.ch == '%') { sc.Forward(); } else if (sc.ch == '\'') { sc.Forward(); sc.SetState(SCE_EIFFEL_DEFAULT); } } if (sc.state == SCE_EIFFEL_DEFAULT) { if (sc.ch == '-' && sc.chNext == '-') { sc.SetState(SCE_EIFFEL_COMMENTLINE); } else if (sc.ch == '\"') { sc.SetState(SCE_EIFFEL_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_EIFFEL_CHARACTER); } else if (IsADigit(sc.ch) || (sc.ch == '.')) { sc.SetState(SCE_EIFFEL_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_EIFFEL_WORD); } else if (isEiffelOperator(sc.ch)) { sc.SetState(SCE_EIFFEL_OPERATOR); } } } sc.Complete(); } static bool IsEiffelComment(Accessor &styler, int pos, int len) { return len>1 && styler[pos]=='-' && styler[pos+1]=='-'; } static void FoldEiffelDocIndent(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { int lengthDoc = startPos + length; // Backtrack to previous line in case need to fix its fold status int lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); } } int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment); char chNext = styler[startPos]; for (int i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) { int lev = indentCurrent; int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsEiffelComment); if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { // Only non whitespace lines can be headers if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { // Line after is blank so check the next - maybe should continue further? int spaceFlags2 = 0; int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsEiffelComment); if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } } } indentCurrent = indentNext; styler.SetLevel(lineCurrent, lev); lineCurrent++; } } } static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* initStyle */, WordList *[], Accessor &styler) { unsigned int lengthDoc = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int stylePrev = 0; int styleNext = styler.StyleAt(startPos); // lastDeferred should be determined by looking back to last keyword in case // the "deferred" is on a line before "class" bool lastDeferred = false; for (unsigned int i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) { char s[20]; unsigned int j = 0; while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) { s[j] = styler[i + j]; j++; } s[j] = '\0'; if ( (strcmp(s, "check") == 0) || (strcmp(s, "debug") == 0) || (strcmp(s, "deferred") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "from") == 0) || (strcmp(s, "if") == 0) || (strcmp(s, "inspect") == 0) || (strcmp(s, "once") == 0) ) levelCurrent++; if (!lastDeferred && (strcmp(s, "class") == 0)) levelCurrent++; if (strcmp(s, "end") == 0) levelCurrent--; lastDeferred = strcmp(s, "deferred") == 0; } if (atEOL) { int lev = levelPrev; if (visibleChars == 0) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; stylePrev = style; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const eiffelWordListDesc[] = { "Keywords", 0 }; LexerModule lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent, eiffelWordListDesc); LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords, eiffelWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/CallTip.h0000644000175000001440000000476611407213302021641 0ustar subzerousers// Scintilla source code edit control /** @file CallTip.h ** Interface to the call tip control. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef CALLTIP_H #define CALLTIP_H #ifdef SCI_NAMESPACE namespace Scintilla { #endif /** */ class CallTip { int startHighlight; // character offset to start and... int endHighlight; // ...end of highlighted text char *val; Font font; PRectangle rectUp; // rectangle of last up angle in the tip PRectangle rectDown; // rectangle of last down arrow in the tip int lineHeight; // vertical line spacing int offsetMain; // The alignment point of the call tip int tabSize; // Tab size in pixels, <=0 no TAB expand bool useStyleCallTip; // if true, STYLE_CALLTIP should be used // Private so CallTip objects can not be copied CallTip(const CallTip &) {} CallTip &operator=(const CallTip &) { return *this; } void DrawChunk(Surface *surface, int &x, const char *s, int posStart, int posEnd, int ytext, PRectangle rcClient, bool highlight, bool draw); int PaintContents(Surface *surfaceWindow, bool draw); bool IsTabCharacter(char c); int NextTabPos(int x); public: Window wCallTip; Window wDraw; bool inCallTipMode; int posStartCallTip; ColourPair colourBG; ColourPair colourUnSel; ColourPair colourSel; ColourPair colourShade; ColourPair colourLight; int codePage; int clickPlace; CallTip(); ~CallTip(); /// Claim or accept palette entries for the colours required to paint a calltip. void RefreshColourPalette(Palette &pal, bool want); void PaintCT(Surface *surfaceWindow); void MouseClick(Point pt); /// Setup the calltip and return a rectangle of the area required. PRectangle CallTipStart(int pos, Point pt, const char *defn, const char *faceName, int size, int codePage_, int characterSet, Window &wParent); void CallTipCancel(); /// Set a range of characters to be displayed in a highlight style. /// Commonly used to highlight the current parameter. void SetHighlight(int start, int end); /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand. void SetTabSize(int tabSz); /// Used to determine which STYLE_xxxx to use for call tip information bool UseStyleCallTip() const { return useStyleCallTip;} // Modify foreground and background colours void SetForeBack(const ColourPair &fore, const ColourPair &back); }; #ifdef SCI_NAMESPACE } #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/LexBash.cpp0000644000175000001440000004522711407213302022167 0ustar subzerousers// Scintilla source code edit control /** @file LexBash.cxx ** Lexer for Bash. **/ // Copyright 2004-2005 by Neil Hodgson // Adapted from LexPerl by Kein-Hong Man 2004 // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #define BASH_BASE_ERROR 65 #define BASH_BASE_DECIMAL 66 #define BASH_BASE_HEX 67 #define BASH_BASE_OCTAL 68 #define BASH_BASE_OCTAL_ERROR 69 #define HERE_DELIM_MAX 256 #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static inline int translateBashDigit(char ch) { if (ch >= '0' && ch <= '9') { return ch - '0'; } else if (ch >= 'a' && ch <= 'z') { return ch - 'a' + 10; } else if (ch >= 'A' && ch <= 'Z') { return ch - 'A' + 36; } else if (ch == '@') { return 62; } else if (ch == '_') { return 63; } return BASH_BASE_ERROR; } static inline bool isEOLChar(char ch) { return (ch == '\r') || (ch == '\n'); } static bool isSingleCharOp(char ch) { char strCharSet[2]; strCharSet[0] = ch; strCharSet[1] = '\0'; return (NULL != strstr("rwxoRWXOezsfdlpSbctugkTBMACahGLNn", strCharSet)); } static inline bool isBashOperator(char ch) { if (ch == '^' || ch == '&' || ch == '\\' || ch == '%' || ch == '(' || ch == ')' || ch == '-' || ch == '+' || ch == '=' || ch == '|' || ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == ':' || ch == ';' || ch == '>' || ch == ',' || ch == '/' || ch == '<' || ch == '?' || ch == '!' || ch == '.' || ch == '~' || ch == '@') return true; return false; } static int classifyWordBash(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[100]; for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; s[i + 1] = '\0'; } char chAttr = SCE_SH_IDENTIFIER; if (keywords.InList(s)) chAttr = SCE_SH_WORD; styler.ColourTo(end, chAttr); return chAttr; } static inline int getBashNumberBase(unsigned int start, unsigned int end, Accessor &styler) { int base = 0; for (unsigned int i = 0; i < end - start + 1 && i < 10; i++) { base = base * 10 + (styler[start + i] - '0'); } if (base > 64 || (end - start) > 1) { return BASH_BASE_ERROR; } return base; } static inline bool isEndVar(char ch) { return !isalnum(ch) && ch != '$' && ch != '_'; } static inline bool isNonQuote(char ch) { return isalnum(ch) || ch == '_'; } static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) { if ((pos + static_cast(strlen(val))) >= lengthDoc) { return false; } while (*val) { if (*val != styler[pos++]) { return false; } val++; } return true; } static char opposite(char ch) { if (ch == '(') return ')'; if (ch == '[') return ']'; if (ch == '{') return '}'; if (ch == '<') return '>'; return ch; } static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { // Lexer for bash often has to backtrack to start of current style to determine // which characters are being used as quotes, how deeply nested is the // start position and what the termination string is for here documents WordList &keywords = *keywordlists[0]; class HereDocCls { public: int State; // 0: '<<' encountered // 1: collect the delimiter // 2: here doc text (lines after the delimiter) char Quote; // the char after '<<' bool Quoted; // true if Quote in ('\'','"','`') bool Indent; // indented delimiter (for <<-) int DelimiterLength; // strlen(Delimiter) char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf HereDocCls() { State = 0; Quote = 0; Quoted = false; Indent = 0; DelimiterLength = 0; Delimiter = new char[HERE_DELIM_MAX]; Delimiter[0] = '\0'; } ~HereDocCls() { delete []Delimiter; } }; HereDocCls HereDoc; class QuoteCls { public: int Rep; int Count; char Up; char Down; QuoteCls() { this->New(1); } void New(int r) { Rep = r; Count = 0; Up = '\0'; Down = '\0'; } void Open(char u) { Count++; Up = u; Down = opposite(Up); } }; QuoteCls Quote; int state = initStyle; int numBase = 0; unsigned int lengthDoc = startPos + length; // If in a long distance lexical state, seek to the beginning to find quote characters // Bash strings can be multi-line with embedded newlines, so backtrack. // Bash numbers have additional state during lexing, so backtrack too. if (state == SCE_SH_HERE_Q) { while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_SH_HERE_DELIM)) { startPos--; } startPos = styler.LineStart(styler.GetLine(startPos)); state = styler.StyleAt(startPos - 1); } if (state == SCE_SH_STRING || state == SCE_SH_BACKTICKS || state == SCE_SH_CHARACTER || state == SCE_SH_NUMBER || state == SCE_SH_IDENTIFIER || state == SCE_SH_COMMENTLINE ) { while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) { startPos--; } state = SCE_SH_DEFAULT; } styler.StartAt(startPos); char chPrev = styler.SafeGetCharAt(startPos - 1); if (startPos == 0) chPrev = '\n'; char chNext = styler[startPos]; styler.StartSegment(startPos); for (unsigned int i = startPos; i < lengthDoc; i++) { char ch = chNext; // if the current character is not consumed due to the completion of an // earlier style, lexing can be restarted via a simple goto restartLexer: chNext = styler.SafeGetCharAt(i + 1); char chNext2 = styler.SafeGetCharAt(i + 2); if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); chPrev = ' '; i += 1; continue; } if ((chPrev == '\r' && ch == '\n')) { // skip on DOS/Windows styler.ColourTo(i, state); chPrev = ch; continue; } if (HereDoc.State == 1 && isEOLChar(ch)) { // Begin of here-doc (the line after the here-doc delimiter): // Lexically, the here-doc starts from the next line after the >>, but the // first line of here-doc seem to follow the style of the last EOL sequence HereDoc.State = 2; if (HereDoc.Quoted) { if (state == SCE_SH_HERE_DELIM) { // Missing quote at end of string! We are stricter than bash. // Colour here-doc anyway while marking this bit as an error. state = SCE_SH_ERROR; } styler.ColourTo(i - 1, state); // HereDoc.Quote always == '\'' state = SCE_SH_HERE_Q; } else { styler.ColourTo(i - 1, state); // always switch state = SCE_SH_HERE_Q; } } if (state == SCE_SH_DEFAULT) { if (ch == '\\') { // escaped character if (i < lengthDoc - 1) i++; ch = chNext; chNext = chNext2; styler.ColourTo(i, SCE_SH_IDENTIFIER); } else if (isdigit(ch)) { state = SCE_SH_NUMBER; numBase = BASH_BASE_DECIMAL; if (ch == '0') { // hex,octal if (chNext == 'x' || chNext == 'X') { numBase = BASH_BASE_HEX; i++; ch = chNext; chNext = chNext2; } else if (isdigit(chNext)) { numBase = BASH_BASE_OCTAL; } } } else if (iswordstart(ch)) { state = SCE_SH_WORD; if (!iswordchar(chNext) && chNext != '+' && chNext != '-') { // We need that if length of word == 1! // This test is copied from the SCE_SH_WORD handler. classifyWordBash(styler.GetStartSegment(), i, keywords, styler); state = SCE_SH_DEFAULT; } } else if (ch == '#') { state = SCE_SH_COMMENTLINE; } else if (ch == '\"') { state = SCE_SH_STRING; Quote.New(1); Quote.Open(ch); } else if (ch == '\'') { state = SCE_SH_CHARACTER; Quote.New(1); Quote.Open(ch); } else if (ch == '`') { state = SCE_SH_BACKTICKS; Quote.New(1); Quote.Open(ch); } else if (ch == '$') { if (chNext == '{') { state = SCE_SH_PARAM; goto startQuote; } else if (chNext == '\'') { state = SCE_SH_CHARACTER; goto startQuote; } else if (chNext == '"') { state = SCE_SH_STRING; goto startQuote; } else if (chNext == '(' && chNext2 == '(') { styler.ColourTo(i, SCE_SH_OPERATOR); state = SCE_SH_DEFAULT; goto skipChar; } else if (chNext == '(' || chNext == '`') { state = SCE_SH_BACKTICKS; startQuote: Quote.New(1); Quote.Open(chNext); goto skipChar; } else { state = SCE_SH_SCALAR; skipChar: i++; ch = chNext; chNext = chNext2; } } else if (ch == '*') { if (chNext == '*') { // exponentiation i++; ch = chNext; chNext = chNext2; } styler.ColourTo(i, SCE_SH_OPERATOR); } else if (ch == '<' && chNext == '<') { state = SCE_SH_HERE_DELIM; HereDoc.State = 0; HereDoc.Indent = false; } else if (ch == '-' // file test operators && isSingleCharOp(chNext) && !isalnum((chNext2 = styler.SafeGetCharAt(i+2))) && isspace(chPrev)) { styler.ColourTo(i + 1, SCE_SH_WORD); state = SCE_SH_DEFAULT; i++; ch = chNext; chNext = chNext2; } else if (isBashOperator(ch)) { styler.ColourTo(i, SCE_SH_OPERATOR); } else { // keep colouring defaults to make restart easier styler.ColourTo(i, SCE_SH_DEFAULT); } } else if (state == SCE_SH_NUMBER) { int digit = translateBashDigit(ch); if (numBase == BASH_BASE_DECIMAL) { if (ch == '#') { numBase = getBashNumberBase(styler.GetStartSegment(), i - 1, styler); if (numBase == BASH_BASE_ERROR) // take the rest as comment goto numAtEnd; } else if (!isdigit(ch)) goto numAtEnd; } else if (numBase == BASH_BASE_HEX) { if ((digit < 16) || (digit >= 36 && digit <= 41)) { // hex digit 0-9a-fA-F } else goto numAtEnd; } else if (numBase == BASH_BASE_OCTAL || numBase == BASH_BASE_OCTAL_ERROR) { if (digit > 7) { if (digit <= 9) { numBase = BASH_BASE_OCTAL_ERROR; } else goto numAtEnd; } } else if (numBase == BASH_BASE_ERROR) { if (digit > 9) goto numAtEnd; } else { // DD#DDDD number style handling if (digit != BASH_BASE_ERROR) { if (numBase <= 36) { // case-insensitive if base<=36 if (digit >= 36) digit -= 26; } if (digit >= numBase) { if (digit <= 9) { numBase = BASH_BASE_ERROR; } else goto numAtEnd; } } else { numAtEnd: if (numBase == BASH_BASE_ERROR || numBase == BASH_BASE_OCTAL_ERROR) state = SCE_SH_ERROR; styler.ColourTo(i - 1, state); state = SCE_SH_DEFAULT; goto restartLexer; } } } else if (state == SCE_SH_WORD) { if (!iswordchar(chNext) && chNext != '+' && chNext != '-') { // "." never used in Bash variable names // but used in file names classifyWordBash(styler.GetStartSegment(), i, keywords, styler); state = SCE_SH_DEFAULT; ch = ' '; } } else if (state == SCE_SH_IDENTIFIER) { if (!iswordchar(chNext) && chNext != '+' && chNext != '-') { styler.ColourTo(i, SCE_SH_IDENTIFIER); state = SCE_SH_DEFAULT; ch = ' '; } } else { if (state == SCE_SH_COMMENTLINE) { if (ch == '\\' && isEOLChar(chNext)) { // comment continuation if (chNext == '\r' && chNext2 == '\n') { i += 2; ch = styler.SafeGetCharAt(i); chNext = styler.SafeGetCharAt(i + 1); } else { i++; ch = chNext; chNext = chNext2; } } else if (isEOLChar(ch)) { styler.ColourTo(i - 1, state); state = SCE_SH_DEFAULT; goto restartLexer; } else if (isEOLChar(chNext)) { styler.ColourTo(i, state); state = SCE_SH_DEFAULT; } } else if (state == SCE_SH_HERE_DELIM) { // // From Bash info: // --------------- // Specifier format is: <<[-]WORD // Optional '-' is for removal of leading tabs from here-doc. // Whitespace acceptable after <<[-] operator // if (HereDoc.State == 0) { // '<<' encountered HereDoc.State = 1; HereDoc.Quote = chNext; HereDoc.Quoted = false; HereDoc.DelimiterLength = 0; HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; if (chNext == '\'' || chNext == '\"') { // a quoted here-doc delimiter (' or ") i++; ch = chNext; chNext = chNext2; HereDoc.Quoted = true; } else if (!HereDoc.Indent && chNext == '-') { // <<- indent case HereDoc.Indent = true; HereDoc.State = 0; } else if (isalpha(chNext) || chNext == '_' || chNext == '\\' || chNext == '-' || chNext == '+' || chNext == '!') { // an unquoted here-doc delimiter, no special handling // TODO check what exactly bash considers part of the delim } else if (chNext == '<') { // HERE string <<< i++; ch = chNext; chNext = chNext2; styler.ColourTo(i, SCE_SH_HERE_DELIM); state = SCE_SH_DEFAULT; HereDoc.State = 0; } else if (isspacechar(chNext)) { // eat whitespace HereDoc.State = 0; } else if (isdigit(chNext) || chNext == '=' || chNext == '$') { // left shift << or <<= operator cases styler.ColourTo(i, SCE_SH_OPERATOR); state = SCE_SH_DEFAULT; HereDoc.State = 0; } else { // symbols terminates; deprecated zero-length delimiter } } else if (HereDoc.State == 1) { // collect the delimiter if (HereDoc.Quoted) { // a quoted here-doc delimiter if (ch == HereDoc.Quote) { // closing quote => end of delimiter styler.ColourTo(i, state); state = SCE_SH_DEFAULT; } else { if (ch == '\\' && chNext == HereDoc.Quote) { // escaped quote i++; ch = chNext; chNext = chNext2; } HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; } } else { // an unquoted here-doc delimiter if (isalnum(ch) || ch == '_' || ch == '-' || ch == '+' || ch == '!') { HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; } else if (ch == '\\') { // skip escape prefix } else { styler.ColourTo(i - 1, state); state = SCE_SH_DEFAULT; goto restartLexer; } } if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { styler.ColourTo(i - 1, state); state = SCE_SH_ERROR; goto restartLexer; } } } else if (HereDoc.State == 2) { // state == SCE_SH_HERE_Q if (isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) { if (!HereDoc.Indent && isEOLChar(chPrev)) { endHereDoc: // standard HERE delimiter i += HereDoc.DelimiterLength; chPrev = styler.SafeGetCharAt(i - 1); ch = styler.SafeGetCharAt(i); if (isEOLChar(ch)) { styler.ColourTo(i - 1, state); state = SCE_SH_DEFAULT; HereDoc.State = 0; goto restartLexer; } chNext = styler.SafeGetCharAt(i + 1); } else if (HereDoc.Indent) { // indented HERE delimiter unsigned int bk = (i > 0)? i - 1: 0; while (i > 0) { ch = styler.SafeGetCharAt(bk--); if (isEOLChar(ch)) { goto endHereDoc; } else if (!isspacechar(ch)) { break; // got leading non-whitespace } } } } } else if (state == SCE_SH_SCALAR) { // variable names if (isEndVar(ch)) { if ((state == SCE_SH_SCALAR) && i == (styler.GetStartSegment() + 1)) { // Special variable: $(, $_ etc. styler.ColourTo(i, state); state = SCE_SH_DEFAULT; } else { styler.ColourTo(i - 1, state); state = SCE_SH_DEFAULT; goto restartLexer; } } } else if (state == SCE_SH_STRING || state == SCE_SH_CHARACTER || state == SCE_SH_BACKTICKS || state == SCE_SH_PARAM ) { if (!Quote.Down && !isspacechar(ch)) { Quote.Open(ch); } else if (ch == '\\' && Quote.Up != '\\') { i++; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); } else if (ch == Quote.Down) { Quote.Count--; if (Quote.Count == 0) { Quote.Rep--; if (Quote.Rep <= 0) { styler.ColourTo(i, state); state = SCE_SH_DEFAULT; ch = ' '; } if (Quote.Up == Quote.Down) { Quote.Count++; } } } else if (ch == Quote.Up) { Quote.Count++; } } } if (state == SCE_SH_ERROR) { break; } chPrev = ch; } styler.ColourTo(lengthDoc - 1, state); } static bool IsCommentLine(int line, Accessor &styler) { int pos = styler.LineStart(line); int eol_pos = styler.LineStart(line + 1) - 1; for (int i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; else if (ch != ' ' && ch != '\t') return false; } return false; } static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); // Comment folding if (foldComment && atEOL && IsCommentLine(lineCurrent, styler)) { if (!IsCommentLine(lineCurrent - 1, styler) && IsCommentLine(lineCurrent + 1, styler)) levelCurrent++; else if (IsCommentLine(lineCurrent - 1, styler) && !IsCommentLine(lineCurrent+1, styler)) levelCurrent--; } if (style == SCE_SH_OPERATOR) { if (ch == '{') { levelCurrent++; } else if (ch == '}') { levelCurrent--; } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const bashWordListDesc[] = { "Keywords", 0 }; LexerModule lmBash(SCLEX_BASH, ColouriseBashDoc, "bash", FoldBashDoc, bashWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/ScintillaBase.cpp0000644000175000001440000004377711407213302023366 0ustar subzerousers// Scintilla source code edit control /** @file ScintillaBase.cxx ** An enhanced subclass of Editor with calltips, autocomplete and context menu. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include "Platform.h" #include "Scintilla.h" #include "PropSet.h" #ifdef SCI_LEXER #include "SciLexer.h" #include "Accessor.h" #include "DocumentAccessor.h" #include "KeyWords.h" #endif #include "ContractionState.h" #include "SVector.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" #include "CellBuffer.h" #include "CallTip.h" #include "KeyMap.h" #include "Indicator.h" #include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" #include "AutoComplete.h" #include "CharClassify.h" #include "Decoration.h" #include "Document.h" #include "PositionCache.h" #include "Editor.h" #include "ScintillaBase.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif ScintillaBase::ScintillaBase() { displayPopupMenu = true; listType = 0; maxListWidth = 0; #ifdef SCI_LEXER lexLanguage = SCLEX_CONTAINER; performingStyle = false; lexCurrent = 0; for (int wl = 0;wl < numWordLists;wl++) keyWordLists[wl] = new WordList; keyWordLists[numWordLists] = 0; #endif } ScintillaBase::~ScintillaBase() { #ifdef SCI_LEXER for (int wl = 0;wl < numWordLists;wl++) delete keyWordLists[wl]; #endif } void ScintillaBase::Finalise() { Editor::Finalise(); popup.Destroy(); } void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) { Editor::RefreshColourPalette(pal, want); ct.RefreshColourPalette(pal, want); } void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { bool isFillUp = ac.Active() && ac.IsFillUpChar(*s); if (!isFillUp) { Editor::AddCharUTF(s, len, treatAsDBCS); } if (ac.Active()) { AutoCompleteCharacterAdded(s[0]); // For fill ups add the character after the autocompletion has // triggered so containers see the key so can display a calltip. if (isFillUp) { Editor::AddCharUTF(s, len, treatAsDBCS); } } } void ScintillaBase::Command(int cmdId) { switch (cmdId) { case idAutoComplete: // Nothing to do break; case idCallTip: // Nothing to do break; case idcmdUndo: WndProc(SCI_UNDO, 0, 0); break; case idcmdRedo: WndProc(SCI_REDO, 0, 0); break; case idcmdCut: WndProc(SCI_CUT, 0, 0); break; case idcmdCopy: WndProc(SCI_COPY, 0, 0); break; case idcmdPaste: WndProc(SCI_PASTE, 0, 0); break; case idcmdDelete: WndProc(SCI_CLEAR, 0, 0); break; case idcmdSelectAll: WndProc(SCI_SELECTALL, 0, 0); break; } } int ScintillaBase::KeyCommand(unsigned int iMessage) { // Most key commands cancel autocompletion mode if (ac.Active()) { switch (iMessage) { // Except for these case SCI_LINEDOWN: AutoCompleteMove(1); return 0; case SCI_LINEUP: AutoCompleteMove( -1); return 0; case SCI_PAGEDOWN: AutoCompleteMove(5); return 0; case SCI_PAGEUP: AutoCompleteMove( -5); return 0; case SCI_VCHOME: AutoCompleteMove( -5000); return 0; case SCI_LINEEND: AutoCompleteMove(5000); return 0; case SCI_DELETEBACK: DelCharBack(true); AutoCompleteCharacterDeleted(); EnsureCaretVisible(); return 0; case SCI_DELETEBACKNOTLINE: DelCharBack(false); AutoCompleteCharacterDeleted(); EnsureCaretVisible(); return 0; case SCI_TAB: AutoCompleteCompleted(); return 0; case SCI_NEWLINE: AutoCompleteCompleted(); return 0; default: ac.Cancel(); } } if (ct.inCallTipMode) { if ( (iMessage != SCI_CHARLEFT) && (iMessage != SCI_CHARLEFTEXTEND) && (iMessage != SCI_CHARRIGHT) && (iMessage != SCI_CHARLEFTEXTEND) && (iMessage != SCI_EDITTOGGLEOVERTYPE) && (iMessage != SCI_DELETEBACK) && (iMessage != SCI_DELETEBACKNOTLINE) ) { ct.CallTipCancel(); } if ((iMessage == SCI_DELETEBACK) || (iMessage == SCI_DELETEBACKNOTLINE)) { if (currentPos <= ct.posStartCallTip) { ct.CallTipCancel(); } } } return Editor::KeyCommand(iMessage); } void ScintillaBase::AutoCompleteDoubleClick(void* p) { ScintillaBase* sci = reinterpret_cast(p); sci->AutoCompleteCompleted(); } void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { //Platform::DebugPrintf("AutoComplete %s\n", list); ct.CallTipCancel(); if (ac.chooseSingle && (listType == 0)) { if (list && !strchr(list, ac.GetSeparator())) { const char *typeSep = strchr(list, ac.GetTypesep()); size_t lenInsert = (typeSep) ? (typeSep-list) : strlen(list); if (ac.ignoreCase) { SetEmptySelection(currentPos - lenEntered); pdoc->DeleteChars(currentPos, lenEntered); SetEmptySelection(currentPos); pdoc->InsertString(currentPos, list, lenInsert); SetEmptySelection(currentPos + lenInsert); } else { SetEmptySelection(currentPos); pdoc->InsertString(currentPos, list + lenEntered, lenInsert - lenEntered); SetEmptySelection(currentPos + lenInsert - lenEntered); } return; } } ac.Start(wMain, idAutoComplete, currentPos, LocationFromPosition(currentPos), lenEntered, vs.lineHeight, IsUnicodeMode()); PRectangle rcClient = GetClientRectangle(); Point pt = LocationFromPosition(currentPos - lenEntered); int heightLB = 100; int widthLB = 100; if (pt.x >= rcClient.right - widthLB) { HorizontalScrollTo(xOffset + pt.x - rcClient.right + widthLB); Redraw(); pt = LocationFromPosition(currentPos); } PRectangle rcac; rcac.left = pt.x - ac.lb->CaretFromEdge(); if (pt.y >= rcClient.bottom - heightLB && // Wont fit below. pt.y >= (rcClient.bottom + rcClient.top) / 2) { // and there is more room above. rcac.top = pt.y - heightLB; if (rcac.top < 0) { heightLB += rcac.top; rcac.top = 0; } } else { rcac.top = pt.y + vs.lineHeight; } rcac.right = rcac.left + widthLB; rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom); ac.lb->SetPositionRelative(rcac, wMain); ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font); unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth; ac.lb->SetAverageCharWidth(aveCharWidth); ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this); ac.SetList(list); // Fiddle the position of the list so it is right next to the target and wide enough for all its strings PRectangle rcList = ac.lb->GetDesiredRect(); int heightAlloced = rcList.bottom - rcList.top; widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left); if (maxListWidth != 0) widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth); // Make an allowance for large strings in list rcList.left = pt.x - ac.lb->CaretFromEdge(); rcList.right = rcList.left + widthLB; if (((pt.y + vs.lineHeight) >= (rcClient.bottom - heightAlloced)) && // Wont fit below. ((pt.y + vs.lineHeight / 2) >= (rcClient.bottom + rcClient.top) / 2)) { // and there is more room above. rcList.top = pt.y - heightAlloced; } else { rcList.top = pt.y + vs.lineHeight; } rcList.bottom = rcList.top + heightAlloced; ac.lb->SetPositionRelative(rcList, wMain); ac.Show(true); if (lenEntered != 0) { AutoCompleteMoveToCurrentWord(); } } void ScintillaBase::AutoCompleteCancel() { ac.Cancel(); } void ScintillaBase::AutoCompleteMove(int delta) { ac.Move(delta); } void ScintillaBase::AutoCompleteMoveToCurrentWord() { char wordCurrent[1000]; int i; int startWord = ac.posStart - ac.startLen; for (i = startWord; i < currentPos && i - startWord < 1000; i++) wordCurrent[i - startWord] = pdoc->CharAt(i); wordCurrent[Platform::Minimum(i - startWord, 999)] = '\0'; ac.Select(wordCurrent); } void ScintillaBase::AutoCompleteCharacterAdded(char ch) { if (ac.IsFillUpChar(ch)) { AutoCompleteCompleted(); } else if (ac.IsStopChar(ch)) { ac.Cancel(); } else { AutoCompleteMoveToCurrentWord(); } } void ScintillaBase::AutoCompleteCharacterDeleted() { if (currentPos < ac.posStart - ac.startLen) { ac.Cancel(); } else if (ac.cancelAtStartPos && (currentPos <= ac.posStart)) { ac.Cancel(); } else { AutoCompleteMoveToCurrentWord(); } } void ScintillaBase::AutoCompleteCompleted() { int item = ac.lb->GetSelection(); char selected[1000]; selected[0] = '\0'; if (item != -1) { ac.lb->GetValue(item, selected, sizeof(selected)); } else { ac.Cancel(); return; } ac.Show(false); listSelected = selected; SCNotification scn = {0}; scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION; scn.message = 0; scn.wParam = listType; scn.listType = listType; Position firstPos = ac.posStart - ac.startLen; scn.lParam = firstPos; scn.text = listSelected.c_str(); NotifyParent(scn); if (!ac.Active()) return; ac.Cancel(); if (listType > 0) return; Position endPos = currentPos; if (ac.dropRestOfWord) endPos = pdoc->ExtendWordSelect(endPos, 1, true); if (endPos < firstPos) return; pdoc->BeginUndoAction(); if (endPos != firstPos) { pdoc->DeleteChars(firstPos, endPos - firstPos); } SetEmptySelection(ac.posStart); if (item != -1) { SString piece = selected; pdoc->InsertCString(firstPos, piece.c_str()); SetEmptySelection(firstPos + static_cast(piece.length())); } pdoc->EndUndoAction(); } int ScintillaBase::AutoCompleteGetCurrent() { return ac.lb->GetSelection(); } void ScintillaBase::CallTipShow(Point pt, const char *defn) { AutoCompleteCancel(); pt.y += vs.lineHeight; // If container knows about STYLE_CALLTIP then use it in place of the // STYLE_DEFAULT for the face name, size and character set. Also use it // for the foreground and background colour. int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT; if (ct.UseStyleCallTip()) { ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back); } PRectangle rc = ct.CallTipStart(currentPos, pt, defn, vs.styles[ctStyle].fontName, vs.styles[ctStyle].sizeZoomed, CodePage(), vs.styles[ctStyle].characterSet, wMain); // If the call-tip window would be out of the client // space, adjust so it displays above the text. PRectangle rcClient = GetClientRectangle(); if (rc.bottom > rcClient.bottom) { int offset = vs.lineHeight + rc.Height(); rc.top -= offset; rc.bottom -= offset; } // Now display the window. CreateCallTipWindow(rc); ct.wCallTip.SetPositionRelative(rc, wMain); ct.wCallTip.Show(); } void ScintillaBase::CallTipClick() { SCNotification scn = {0}; scn.nmhdr.code = SCN_CALLTIPCLICK; scn.position = ct.clickPlace; NotifyParent(scn); } void ScintillaBase::ContextMenu(Point pt) { if (displayPopupMenu) { bool writable = !WndProc(SCI_GETREADONLY, 0, 0); popup.CreatePopUp(); AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo()); AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo()); AddToPopUp(""); AddToPopUp("Cut", idcmdCut, writable && currentPos != anchor); AddToPopUp("Copy", idcmdCopy, currentPos != anchor); AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0)); AddToPopUp("Delete", idcmdDelete, writable && currentPos != anchor); AddToPopUp(""); AddToPopUp("Select All", idcmdSelectAll); popup.Show(pt, wMain); } } void ScintillaBase::CancelModes() { AutoCompleteCancel(); ct.CallTipCancel(); Editor::CancelModes(); } void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { CancelModes(); Editor::ButtonDown(pt, curTime, shift, ctrl, alt); } #ifdef SCI_LEXER void ScintillaBase::SetLexer(uptr_t wParam) { lexLanguage = wParam; lexCurrent = LexerModule::Find(lexLanguage); if (!lexCurrent) lexCurrent = LexerModule::Find(SCLEX_NULL); } void ScintillaBase::SetLexerLanguage(const char *languageName) { lexLanguage = SCLEX_CONTAINER; lexCurrent = LexerModule::Find(languageName); if (!lexCurrent) lexCurrent = LexerModule::Find(SCLEX_NULL); if (lexCurrent) lexLanguage = lexCurrent->GetLanguage(); } void ScintillaBase::Colourise(int start, int end) { if (!performingStyle) { // Protect against reentrance, which may occur, for example, when // fold points are discovered while performing styling and the folding // code looks for child lines which may trigger styling. performingStyle = true; int lengthDoc = pdoc->Length(); if (end == -1) end = lengthDoc; int len = end - start; PLATFORM_ASSERT(len >= 0); PLATFORM_ASSERT(start + len <= lengthDoc); //WindowAccessor styler(wMain.GetID(), props); DocumentAccessor styler(pdoc, props, wMain.GetID()); int styleStart = 0; if (start > 0) styleStart = styler.StyleAt(start - 1) & pdoc->stylingBitsMask; styler.SetCodePage(pdoc->dbcsCodePage); if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available lexCurrent->Lex(start, len, styleStart, keyWordLists, styler); styler.Flush(); if (styler.GetPropertyInt("fold")) { lexCurrent->Fold(start, len, styleStart, keyWordLists, styler); styler.Flush(); } } performingStyle = false; } } #endif void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { #ifdef SCI_LEXER if (lexLanguage != SCLEX_CONTAINER) { int endStyled = WndProc(SCI_GETENDSTYLED, 0, 0); int lineEndStyled = WndProc(SCI_LINEFROMPOSITION, endStyled, 0); endStyled = WndProc(SCI_POSITIONFROMLINE, lineEndStyled, 0); Colourise(endStyled, endStyleNeeded); return; } #endif Editor::NotifyStyleToNeeded(endStyleNeeded); } sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { switch (iMessage) { case SCI_AUTOCSHOW: listType = 0; AutoCompleteStart(wParam, reinterpret_cast(lParam)); break; case SCI_AUTOCCANCEL: AutoCompleteCancel(); break; case SCI_AUTOCACTIVE: return ac.Active(); case SCI_AUTOCPOSSTART: return ac.posStart; case SCI_AUTOCCOMPLETE: AutoCompleteCompleted(); break; case SCI_AUTOCSETSEPARATOR: ac.SetSeparator(static_cast(wParam)); break; case SCI_AUTOCGETSEPARATOR: return ac.GetSeparator(); case SCI_AUTOCSTOPS: ac.SetStopChars(reinterpret_cast(lParam)); break; case SCI_AUTOCSELECT: ac.Select(reinterpret_cast(lParam)); break; case SCI_AUTOCGETCURRENT: return AutoCompleteGetCurrent(); case SCI_AUTOCSETCANCELATSTART: ac.cancelAtStartPos = wParam != 0; break; case SCI_AUTOCGETCANCELATSTART: return ac.cancelAtStartPos; case SCI_AUTOCSETFILLUPS: ac.SetFillUpChars(reinterpret_cast(lParam)); break; case SCI_AUTOCSETCHOOSESINGLE: ac.chooseSingle = wParam != 0; break; case SCI_AUTOCGETCHOOSESINGLE: return ac.chooseSingle; case SCI_AUTOCSETIGNORECASE: ac.ignoreCase = wParam != 0; break; case SCI_AUTOCGETIGNORECASE: return ac.ignoreCase; case SCI_USERLISTSHOW: listType = wParam; AutoCompleteStart(0, reinterpret_cast(lParam)); break; case SCI_AUTOCSETAUTOHIDE: ac.autoHide = wParam != 0; break; case SCI_AUTOCGETAUTOHIDE: return ac.autoHide; case SCI_AUTOCSETDROPRESTOFWORD: ac.dropRestOfWord = wParam != 0; break; case SCI_AUTOCGETDROPRESTOFWORD: return ac.dropRestOfWord; case SCI_AUTOCSETMAXHEIGHT: ac.lb->SetVisibleRows(wParam); break; case SCI_AUTOCGETMAXHEIGHT: return ac.lb->GetVisibleRows(); case SCI_AUTOCSETMAXWIDTH: maxListWidth = wParam; break; case SCI_AUTOCGETMAXWIDTH: return maxListWidth; case SCI_REGISTERIMAGE: ac.lb->RegisterImage(wParam, reinterpret_cast(lParam)); break; case SCI_CLEARREGISTEREDIMAGES: ac.lb->ClearRegisteredImages(); break; case SCI_AUTOCSETTYPESEPARATOR: ac.SetTypesep(static_cast(wParam)); break; case SCI_AUTOCGETTYPESEPARATOR: return ac.GetTypesep(); case SCI_CALLTIPSHOW: CallTipShow(LocationFromPosition(wParam), reinterpret_cast(lParam)); break; case SCI_CALLTIPCANCEL: ct.CallTipCancel(); break; case SCI_CALLTIPACTIVE: return ct.inCallTipMode; case SCI_CALLTIPPOSSTART: return ct.posStartCallTip; case SCI_CALLTIPSETHLT: ct.SetHighlight(wParam, lParam); break; case SCI_CALLTIPSETBACK: ct.colourBG = ColourDesired(wParam); vs.styles[STYLE_CALLTIP].fore = ct.colourBG; InvalidateStyleRedraw(); break; case SCI_CALLTIPSETFORE: ct.colourUnSel = ColourDesired(wParam); vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel; InvalidateStyleRedraw(); break; case SCI_CALLTIPSETFOREHLT: ct.colourSel = ColourDesired(wParam); InvalidateStyleRedraw(); break; case SCI_CALLTIPUSESTYLE: ct.SetTabSize((int)wParam); InvalidateStyleRedraw(); break; case SCI_USEPOPUP: displayPopupMenu = wParam != 0; break; #ifdef SCI_LEXER case SCI_SETLEXER: SetLexer(wParam); lexLanguage = wParam; break; case SCI_GETLEXER: return lexLanguage; case SCI_COLOURISE: if (lexLanguage == SCLEX_CONTAINER) { pdoc->ModifiedAt(wParam); NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam); } else { Colourise(wParam, lParam); } Redraw(); break; case SCI_SETPROPERTY: props.Set(reinterpret_cast(wParam), reinterpret_cast(lParam)); break; case SCI_GETPROPERTY: { SString val = props.Get(reinterpret_cast(wParam)); const int n = val.length(); if (lParam != 0) { char *ptr = reinterpret_cast(lParam); memcpy(ptr, val.c_str(), n); ptr[n] = '\0'; // terminate } return n; // Not including NUL } case SCI_GETPROPERTYEXPANDED: { SString val = props.GetExpanded(reinterpret_cast(wParam)); const int n = val.length(); if (lParam != 0) { char *ptr = reinterpret_cast(lParam); memcpy(ptr, val.c_str(), n); ptr[n] = '\0'; // terminate } return n; // Not including NUL } case SCI_GETPROPERTYINT: return props.GetInt(reinterpret_cast(wParam), lParam); case SCI_SETKEYWORDS: if (wParam < numWordLists) { keyWordLists[wParam]->Clear(); keyWordLists[wParam]->Set(reinterpret_cast(lParam)); } break; case SCI_SETLEXERLANGUAGE: SetLexerLanguage(reinterpret_cast(lParam)); break; case SCI_GETSTYLEBITSNEEDED: return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5; #endif default: return Editor::WndProc(iMessage, wParam, lParam); } return 0l; } sqliteman-1.2.2/sqliteman/qscintilla2/src/LexLout.cpp0000644000175000001440000001351011407213302022223 0ustar subzerousers// Scintilla source code edit control /** @file LexLout.cxx ** Lexer for the Basser Lout (>= version 3) typesetting language **/ // Copyright 2003 by Kein-Hong Man // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalpha(ch) || ch == '@' || ch == '_'); } static inline bool IsAnOther(const int ch) { return (ch < 0x80) && (ch == '{' || ch == '}' || ch == '!' || ch == '$' || ch == '%' || ch == '&' || ch == '\'' || ch == '(' || ch == ')' || ch == '*' || ch == '+' || ch == ',' || ch == '-' || ch == '.' || ch == '/' || ch == ':' || ch == ';' || ch == '<' || ch == '=' || ch == '>' || ch == '?' || ch == '[' || ch == ']' || ch == '^' || ch == '`' || ch == '|' || ch == '~'); } static void ColouriseLoutDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; int visibleChars = 0; int firstWordInLine = 0; int leadingAtSign = 0; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineStart && (sc.state == SCE_LOUT_STRING)) { // Prevent SCE_LOUT_STRINGEOL from leaking back to previous line sc.SetState(SCE_LOUT_STRING); } // Determine if the current state should terminate. if (sc.state == SCE_LOUT_COMMENT) { if (sc.atLineEnd) { sc.SetState(SCE_LOUT_DEFAULT); visibleChars = 0; } } else if (sc.state == SCE_LOUT_NUMBER) { if (!IsADigit(sc.ch) && sc.ch != '.') { sc.SetState(SCE_LOUT_DEFAULT); } } else if (sc.state == SCE_LOUT_STRING) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_LOUT_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_LOUT_STRINGEOL); sc.ForwardSetState(SCE_LOUT_DEFAULT); visibleChars = 0; } } else if (sc.state == SCE_LOUT_IDENTIFIER) { if (!IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (leadingAtSign) { if (keywords.InList(s)) { sc.ChangeState(SCE_LOUT_WORD); } else { sc.ChangeState(SCE_LOUT_WORD4); } } else if (firstWordInLine && keywords3.InList(s)) { sc.ChangeState(SCE_LOUT_WORD3); } sc.SetState(SCE_LOUT_DEFAULT); } } else if (sc.state == SCE_LOUT_OPERATOR) { if (!IsAnOther(sc.ch)) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (keywords2.InList(s)) { sc.ChangeState(SCE_LOUT_WORD2); } sc.SetState(SCE_LOUT_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_LOUT_DEFAULT) { if (sc.ch == '#') { sc.SetState(SCE_LOUT_COMMENT); } else if (sc.ch == '\"') { sc.SetState(SCE_LOUT_STRING); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_LOUT_NUMBER); } else if (IsAWordChar(sc.ch)) { firstWordInLine = (visibleChars == 0); leadingAtSign = (sc.ch == '@'); sc.SetState(SCE_LOUT_IDENTIFIER); } else if (IsAnOther(sc.ch)) { sc.SetState(SCE_LOUT_OPERATOR); } } if (sc.atLineEnd) { // Reset states to begining of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; } if (!IsASpace(sc.ch)) { visibleChars++; } } sc.Complete(); } static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; int styleNext = styler.StyleAt(startPos); char s[10]; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_LOUT_WORD) { if (ch == '@') { for (unsigned int j = 0; j < 8; j++) { if (!IsAWordChar(styler[i + j])) { break; } s[j] = styler[i + j]; s[j + 1] = '\0'; } if (strcmp(s, "@Begin") == 0) { levelCurrent++; } else if (strcmp(s, "@End") == 0) { levelCurrent--; } } } else if (style == SCE_LOUT_OPERATOR) { if (ch == '{') { levelCurrent++; } else if (ch == '}') { levelCurrent--; } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) { lev |= SC_FOLDLEVELWHITEFLAG; } if ((levelCurrent > levelPrev) && (visibleChars > 0)) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const loutWordLists[] = { "Predefined identifiers", "Predefined delimiters", "Predefined keywords", 0, }; LexerModule lmLout(SCLEX_LOUT, ColouriseLoutDoc, "lout", FoldLoutDoc, loutWordLists); sqliteman-1.2.2/sqliteman/qscintilla2/src/LexGen.py0000644000175000001440000002052011407213302021656 0ustar subzerousers# LexGen.py - implemented 2002 by Neil Hodgson neilh@scintilla.org # Released to the public domain. # Regenerate the Scintilla and SciTE source files that list # all the lexers and all the properties files. # Should be run whenever a new lexer is added or removed. # Requires Python 2.4 or later # Most files are regenerated in place with templates stored in comments. # The VS .NET project file is generated into a different file as the # VS .NET environment will not retain comments when modifying the file. # The files are copied to a string apart from sections between a # ++Autogenerated comment and a --Autogenerated comment which is # generated by the CopyWithInsertion function. After the whole # string is instantiated, it is compared with the target file and # if different the file is rewritten. # Does not regenerate the Visual C++ 6 project files but does the VS .NET # project file. import string import sys import os import glob # EOL constants CR = "\r" LF = "\n" CRLF = "\r\n" if sys.platform == "win32": NATIVE = CRLF else: # Yes, LF is the native EOL even on Mac OS X. CR is just for # Mac OS <=9 (a.k.a. "Mac Classic") NATIVE = LF # Automatically generated sections contain start and end comments, # a definition line and the results. # The results are replaced by regenerating based on the definition line. # The definition line is a comment prefix followed by "**". # If there is a digit after the ** then this indicates which list to use # and the digit and next character are not part of the definition # Backslash is used as an escape within the definition line. # The part between \( and \) is repeated for each item in the list. # \* is replaced by each list item. \t, and \n are tab and newline. def CopyWithInsertion(input, commentPrefix, retainDefs, eolType, *lists): copying = 1 listid = 0 output = [] for line in input.splitlines(0): isStartGenerated = line.startswith(commentPrefix + "++Autogenerated") if copying and not isStartGenerated: output.append(line) if isStartGenerated: if retainDefs: output.append(line) copying = 0 definition = "" elif not copying and line.startswith(commentPrefix + "**"): if retainDefs: output.append(line) definition = line[len(commentPrefix + "**"):] listid = 0 if definition[0] in string.digits: listid = int(definition[:1]) definition = definition[2:] # Hide double slashes as a control character definition = definition.replace("\\\\", "\001") # Do some normal C style transforms definition = definition.replace("\\n", "\n") definition = definition.replace("\\t", "\t") # Get the doubled backslashes back as single backslashes definition = definition.replace("\001", "\\") startRepeat = definition.find("\\(") endRepeat = definition.find("\\)") intro = definition[:startRepeat] out = "" if intro.endswith("\n"): pos = 0 else: pos = len(intro) out += intro middle = definition[startRepeat+2:endRepeat] for i in lists[listid]: item = middle.replace("\\*", i) if pos and (pos + len(item) >= 80): out += "\\\n" pos = 0 out += item pos += len(item) if item.endswith("\n"): pos = 0 outro = definition[endRepeat+2:] out += outro out = out.replace("\n", eolType) # correct EOLs in generated content output.append(out) elif line.startswith(commentPrefix + "--Autogenerated"): copying = 1 if retainDefs: output.append(line) output = [line.rstrip(" \t") for line in output] # trim trailing whitespace return eolType.join(output) + eolType def UpdateFile(filename, updated): """ If the file is different to updated then copy updated into the file else leave alone so CVS and make don't treat it as modified. """ try: infile = open(filename, "rb") except IOError: # File is not there yet out = open(filename, "wb") out.write(updated) out.close() print "New", filename return original = infile.read() infile.close() if updated != original: os.unlink(filename) out = open(filename, "wb") out.write(updated) out.close() print "Changed", filename #~ else: #~ print "Unchanged", filename def Generate(inpath, outpath, commentPrefix, eolType, *lists): """Generate 'outpath' from 'inpath'. "eolType" indicates the type of EOLs to use in the generated file. It should be one of following constants: LF, CRLF, CR, or NATIVE. """ #print "generate '%s' -> '%s' (comment prefix: %r, eols: %r)"\ # % (inpath, outpath, commentPrefix, eolType) try: infile = open(inpath, "r") except IOError: print "Can not open", inpath return original = infile.read() infile.close() updated = CopyWithInsertion(original, commentPrefix, inpath == outpath, eolType, *lists) UpdateFile(outpath, updated) def Regenerate(filename, commentPrefix, eolType, *lists): """Regenerate the given file. "eolType" indicates the type of EOLs to use in the generated file. It should be one of following constants: LF, CRLF, CR, or NATIVE. """ Generate(filename, filename, commentPrefix, eolType, *lists) def FindModules(lexFile): modules = [] f = open(lexFile) for l in f.readlines(): if l.startswith("LexerModule"): l = l.replace("(", " ") modules.append(l.split()[1]) return modules knownIrregularProperties = [ "fold", "styling.within.preprocessor", "tab.timmy.whinge.level", "asp.default.language", "html.tags.case.sensitive", "ps.level", "ps.tokenize", "sql.backslash.escapes", "nsis.uservars", "nsis.ignorecase" ] def FindProperties(lexFile): properties = set() f = open(lexFile) for l in f.readlines(): if "GetProperty" in l: l = l.strip() if not l.startswith("//"): # Drop comments propertyName = l.split("\"")[1] if propertyName.lower() == propertyName: # Only allow lower case property names if propertyName in knownIrregularProperties or \ propertyName.startswith("fold.") or \ propertyName.startswith("lexer."): properties.add(propertyName) return properties def ciCompare(a,b): return cmp(a.lower(), b.lower()) def RegenerateAll(): root="../../" # Find all the lexer source code files lexFilePaths = glob.glob(root + "scintilla/src/Lex*.cxx") lexFiles = [os.path.basename(f)[:-4] for f in lexFilePaths] print lexFiles lexerModules = [] lexerProperties = set() for lexFile in lexFilePaths: lexerModules.extend(FindModules(lexFile)) lexerProperties.update(FindProperties(lexFile)) lexerModules.sort(ciCompare) lexerProperties.remove("fold.comment.python") lexerProperties = list(lexerProperties) lexerProperties.sort(ciCompare) # Find all the SciTE properties files otherProps = ["abbrev.properties", "Embedded.properties", "SciTEGlobal.properties", "SciTE.properties"] if os.path.exists(root + "scite"): propFilePaths = glob.glob(root + "scite/src/*.properties") propFiles = [os.path.basename(f) for f in propFilePaths if os.path.basename(f) not in otherProps] propFiles.sort(ciCompare) print propFiles # Find all the menu command IDs in the SciTE header SciTEHeader = file(root + "scite/src/SciTE.h") lines = SciTEHeader.read().split("\n") SciTEHeader.close() ids = [id for id in [l.split()[1] for l in lines if l.startswith("#define")] if id.startswith("IDM_")] #print ids Regenerate(root + "scintilla/src/KeyWords.cxx", "//", NATIVE, lexerModules) Regenerate(root + "scintilla/win32/makefile", "#", NATIVE, lexFiles) Regenerate(root + "scintilla/win32/scintilla.mak", "#", NATIVE, lexFiles) Regenerate(root + "scintilla/win32/scintilla_vc6.mak", "#", NATIVE, lexFiles) # Use Unix EOLs for gtk Makefiles so they work for Linux users when # extracted from the Scintilla source ZIP (typically created on # Windows). Regenerate(root + "scintilla/gtk/makefile", "#", LF, lexFiles) Regenerate(root + "scintilla/gtk/scintilla.mak", "#", NATIVE, lexFiles) Regenerate(root + "scintilla/macosx/makefile", "#", LF, lexFiles) if os.path.exists(root + "scite"): Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles) Regenerate(root + "scite/win32/scite.mak", "#", NATIVE, lexFiles, propFiles) Regenerate(root + "scite/src/SciTEProps.cxx", "//", NATIVE, lexerProperties, ids) Generate(root + "scite/boundscheck/vcproj.gen", root + "scite/boundscheck/SciTE.vcproj", "#", NATIVE, lexFiles) RegenerateAll() sqliteman-1.2.2/sqliteman/qscintilla2/src/LexScriptol.cpp0000644000175000001440000003057511407213302023111 0ustar subzerousers// Scintilla source code edit control /** @file LexScriptol.cxx ** Lexer for Scriptol. **/ #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { char s[100]; bool wordIsNumber = isdigit(styler[start]) != 0; for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; s[i + 1] = '\0'; } char chAttr = SCE_SCRIPTOL_IDENTIFIER; if (0 == strcmp(prevWord, "class")) chAttr = SCE_SCRIPTOL_CLASSNAME; else if (wordIsNumber) chAttr = SCE_SCRIPTOL_NUMBER; else if (keywords.InList(s)) chAttr = SCE_SCRIPTOL_KEYWORD; else for (unsigned int i = 0; i < end - start + 1; i++) // test dotted idents { if (styler[start + i] == '.') { styler.ColourTo(start + i - 1, chAttr); styler.ColourTo(start + i, SCE_SCRIPTOL_OPERATOR); } } styler.ColourTo(end, chAttr); strcpy(prevWord, s); } static bool IsSolComment(Accessor &styler, int pos, int len) { char c; if(len > 0) { c = styler[pos]; if(c == '`') return true; if(len > 1) { if(c == '/') { c = styler[pos + 1]; if(c == '/') return true; if(c == '*') return true; } } } return false; } static bool IsSolStringStart(char ch) { if (ch == '\'' || ch == '"') return true; return false; } static bool IsSolWordStart(char ch) { return (iswordchar(ch) && !IsSolStringStart(ch)); } static int GetSolStringState(Accessor &styler, int i, int *nextIndex) { char ch = styler.SafeGetCharAt(i); char chNext = styler.SafeGetCharAt(i + 1); if (ch != '\"' && ch != '\'') { *nextIndex = i + 1; return SCE_SCRIPTOL_DEFAULT; } // ch is either single or double quotes in string // code below seem non-sense but is here for future extensions if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) { *nextIndex = i + 3; if(ch == '\"') return SCE_SCRIPTOL_TRIPLE; if(ch == '\'') return SCE_SCRIPTOL_TRIPLE; return SCE_SCRIPTOL_STRING; } else { *nextIndex = i + 1; if (ch == '"') return SCE_SCRIPTOL_STRING; else return SCE_SCRIPTOL_STRING; } } static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { int lengthDoc = startPos + length; char stringType = '\"'; if (startPos > 0) { int lineCurrent = styler.GetLine(startPos); if (lineCurrent > 0) { startPos = styler.LineStart(lineCurrent-1); if (startPos == 0) initStyle = SCE_SCRIPTOL_DEFAULT; else initStyle = styler.StyleAt(startPos-1); } } styler.StartAt(startPos, 127); WordList &keywords = *keywordlists[0]; int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level"); char prevWord[200]; prevWord[0] = '\0'; if (length == 0) return; int state = initStyle & 31; int nextIndex = 0; char chPrev = ' '; char chPrev2 = ' '; char chNext = styler[startPos]; styler.StartSegment(startPos); bool atStartLine = true; int spaceFlags = 0; for (int i = startPos; i < lengthDoc; i++) { if (atStartLine) { char chBad = static_cast(64); char chGood = static_cast(0); char chFlags = chGood; if (whingeLevel == 1) { chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood; } else if (whingeLevel == 2) { chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood; } else if (whingeLevel == 3) { chFlags = (spaceFlags & wsSpace) ? chBad : chGood; } else if (whingeLevel == 4) { chFlags = (spaceFlags & wsTab) ? chBad : chGood; } styler.SetFlags(chFlags, static_cast(state)); atStartLine = false; } char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) { if ((state == SCE_SCRIPTOL_DEFAULT) || (state == SCE_SCRIPTOL_TRIPLE) || (state == SCE_SCRIPTOL_COMMENTBLOCK)) { styler.ColourTo(i, state); } atStartLine = true; } if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); chPrev = ' '; chPrev2 = ' '; i += 1; continue; } if (state == SCE_SCRIPTOL_STRINGEOL) { if (ch != '\r' && ch != '\n') { styler.ColourTo(i - 1, state); state = SCE_SCRIPTOL_DEFAULT; } } if (state == SCE_SCRIPTOL_DEFAULT) { if (IsSolWordStart(ch)) { styler.ColourTo(i - 1, state); state = SCE_SCRIPTOL_KEYWORD; } else if (ch == '`') { styler.ColourTo(i - 1, state); state = SCE_SCRIPTOL_COMMENTLINE; } else if (ch == '/') { styler.ColourTo(i - 1, state); if(chNext == '/') state = SCE_SCRIPTOL_CSTYLE; if(chNext == '*') state = SCE_SCRIPTOL_COMMENTBLOCK; } else if (IsSolStringStart(ch)) { styler.ColourTo(i - 1, state); state = GetSolStringState(styler, i, &nextIndex); if(state == SCE_SCRIPTOL_STRING) { stringType = ch; } if (nextIndex != i + 1) { i = nextIndex - 1; ch = ' '; chPrev = ' '; chNext = styler.SafeGetCharAt(i + 1); } } else if (isoperator(ch)) { styler.ColourTo(i - 1, state); styler.ColourTo(i, SCE_SCRIPTOL_OPERATOR); } } else if (state == SCE_SCRIPTOL_KEYWORD) { if (!iswordchar(ch)) { ClassifyWordSol(styler.GetStartSegment(), i - 1, keywords, styler, prevWord); state = SCE_SCRIPTOL_DEFAULT; if (ch == '`') { state = chNext == '`' ? SCE_SCRIPTOL_PERSISTENT : SCE_SCRIPTOL_COMMENTLINE; } else if (IsSolStringStart(ch)) { styler.ColourTo(i - 1, state); state = GetSolStringState(styler, i, &nextIndex); if (nextIndex != i + 1) { i = nextIndex - 1; ch = ' '; chPrev = ' '; chNext = styler.SafeGetCharAt(i + 1); } } else if (isoperator(ch)) { styler.ColourTo(i, SCE_SCRIPTOL_OPERATOR); } } } else { if (state == SCE_SCRIPTOL_COMMENTLINE || state == SCE_SCRIPTOL_PERSISTENT || state == SCE_SCRIPTOL_CSTYLE) { if (ch == '\r' || ch == '\n') { styler.ColourTo(i - 1, state); state = SCE_SCRIPTOL_DEFAULT; } } else if(state == SCE_SCRIPTOL_COMMENTBLOCK) { if(chPrev == '*' && ch == '/') { styler.ColourTo(i, state); state = SCE_SCRIPTOL_DEFAULT; } } else if ((state == SCE_SCRIPTOL_STRING) || (state == SCE_SCRIPTOL_CHARACTER)) { if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { styler.ColourTo(i - 1, state); state = SCE_SCRIPTOL_STRINGEOL; } else if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); } } else if ((ch == '\"') || (ch == '\'')) { // must match the entered quote type if(ch == stringType) { styler.ColourTo(i, state); state = SCE_SCRIPTOL_DEFAULT; } } } else if (state == SCE_SCRIPTOL_TRIPLE) { if ((ch == '\'' && chPrev == '\'' && chPrev2 == '\'') || (ch == '\"' && chPrev == '\"' && chPrev2 == '\"')) { styler.ColourTo(i, state); state = SCE_SCRIPTOL_DEFAULT; } } } chPrev2 = chPrev; chPrev = ch; } if (state == SCE_SCRIPTOL_KEYWORD) { ClassifyWordSol(styler.GetStartSegment(), lengthDoc-1, keywords, styler, prevWord); } else { styler.ColourTo(lengthDoc-1, state); } } static void FoldSolDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { int lengthDoc = startPos + length; int lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); if (startPos == 0) initStyle = SCE_SCRIPTOL_DEFAULT; else initStyle = styler.StyleAt(startPos-1); } } int state = initStyle & 31; int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsSolComment); if ((state == SCE_SCRIPTOL_TRIPLE)) indentCurrent |= SC_FOLDLEVELWHITEFLAG; char chNext = styler[startPos]; for (int i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styler.StyleAt(i) & 31; if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) { int lev = indentCurrent; int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsSolComment); if (style == SCE_SCRIPTOL_TRIPLE) indentNext |= SC_FOLDLEVELWHITEFLAG; if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { // Only non whitespace lines can be headers if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { // Line after is blank so check the next - maybe should continue further? int spaceFlags2 = 0; int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsSolComment); if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } } } indentCurrent = indentNext; styler.SetLevel(lineCurrent, lev); lineCurrent++; } } } LexerModule lmScriptol(SCLEX_SCRIPTOL, ColouriseSolDoc, "scriptol", FoldSolDoc); sqliteman-1.2.2/sqliteman/qscintilla2/src/PositionCache.cpp0000644000175000001440000003334411407213302023366 0ustar subzerousers// Scintilla source code edit control /** @file PositionCache.cxx ** Classes for caching layout information. **/ // Copyright 1998-2007 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include "Platform.h" #include "Scintilla.h" #include "ContractionState.h" #include "SVector.h" #include "SplitVector.h" #include "Partitioning.h" #include "CellBuffer.h" #include "KeyMap.h" #include "RunStyles.h" #include "Indicator.h" #include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" #include "CharClassify.h" #include "Decoration.h" #include "Document.h" #include "PositionCache.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static inline bool IsControlCharacter(int ch) { // iscntrl returns true for lots of chars > 127 which are displayable return ch >= 0 && ch < ' '; } LineLayout::LineLayout(int maxLineLength_) : lineStarts(0), lenLineStarts(0), lineNumber(-1), inCache(false), maxLineLength(-1), numCharsInLine(0), validity(llInvalid), xHighlightGuide(0), highlightColumn(0), selStart(0), selEnd(0), containsCaret(false), edgeColumn(0), chars(0), styles(0), styleBitsSet(0), indicators(0), positions(0), hsStart(0), hsEnd(0), widthLine(wrapWidthInfinite), lines(1) { Resize(maxLineLength_); } LineLayout::~LineLayout() { Free(); } void LineLayout::Resize(int maxLineLength_) { if (maxLineLength_ > maxLineLength) { Free(); chars = new char[maxLineLength_ + 1]; styles = new unsigned char[maxLineLength_ + 1]; indicators = new char[maxLineLength_ + 1]; // Extra position allocated as sometimes the Windows // GetTextExtentExPoint API writes an extra element. positions = new int[maxLineLength_ + 1 + 1]; maxLineLength = maxLineLength_; } } void LineLayout::Free() { delete []chars; chars = 0; delete []styles; styles = 0; delete []indicators; indicators = 0; delete []positions; positions = 0; delete []lineStarts; lineStarts = 0; } void LineLayout::Invalidate(validLevel validity_) { if (validity > validity_) validity = validity_; } int LineLayout::LineStart(int line) const { if (line <= 0) { return 0; } else if ((line >= lines) || !lineStarts) { return numCharsInLine; } else { return lineStarts[line]; } } int LineLayout::LineLastVisible(int line) const { if (line < 0) { return 0; } else if ((line >= lines-1) || !lineStarts) { int startLine = LineStart(line); int endLine = numCharsInLine; while ((endLine > startLine) && IsEOLChar(chars[endLine-1])) { endLine--; } return endLine; } else { return lineStarts[line+1]; } } void LineLayout::SetLineStart(int line, int start) { if ((line >= lenLineStarts) && (line != 0)) { int newMaxLines = line + 20; int *newLineStarts = new int[newMaxLines]; if (!newLineStarts) return; for (int i = 0; i < newMaxLines; i++) { if (i < lenLineStarts) newLineStarts[i] = lineStarts[i]; else newLineStarts[i] = 0; } delete []lineStarts; lineStarts = newLineStarts; lenLineStarts = newMaxLines; } lineStarts[line] = start; } void LineLayout::SetBracesHighlight(Range rangeLine, Position braces[], char bracesMatchStyle, int xHighlight) { if (rangeLine.ContainsCharacter(braces[0])) { int braceOffset = braces[0] - rangeLine.start; if (braceOffset < numCharsInLine) { bracePreviousStyles[0] = styles[braceOffset]; styles[braceOffset] = bracesMatchStyle; } } if (rangeLine.ContainsCharacter(braces[1])) { int braceOffset = braces[1] - rangeLine.start; if (braceOffset < numCharsInLine) { bracePreviousStyles[1] = styles[braceOffset]; styles[braceOffset] = bracesMatchStyle; } } if ((braces[0] >= rangeLine.start && braces[1] <= rangeLine.end) || (braces[1] >= rangeLine.start && braces[0] <= rangeLine.end)) { xHighlightGuide = xHighlight; } } void LineLayout::RestoreBracesHighlight(Range rangeLine, Position braces[]) { if (rangeLine.ContainsCharacter(braces[0])) { int braceOffset = braces[0] - rangeLine.start; if (braceOffset < numCharsInLine) { styles[braceOffset] = bracePreviousStyles[0]; } } if (rangeLine.ContainsCharacter(braces[1])) { int braceOffset = braces[1] - rangeLine.start; if (braceOffset < numCharsInLine) { styles[braceOffset] = bracePreviousStyles[1]; } } xHighlightGuide = 0; } int LineLayout::FindBefore(int x, int lower, int upper) const { do { int middle = (upper + lower + 1) / 2; // Round high int posMiddle = positions[middle]; if (x < posMiddle) { upper = middle - 1; } else { lower = middle; } } while (lower < upper); return lower; } LineLayoutCache::LineLayoutCache() : level(0), length(0), size(0), cache(0), allInvalidated(false), styleClock(-1), useCount(0) { Allocate(0); } LineLayoutCache::~LineLayoutCache() { Deallocate(); } void LineLayoutCache::Allocate(int length_) { PLATFORM_ASSERT(cache == NULL); allInvalidated = false; length = length_; size = length; if (size > 1) { size = (size / 16 + 1) * 16; } if (size > 0) { cache = new LineLayout * [size]; } for (int i = 0; i < size; i++) cache[i] = 0; } void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) { PLATFORM_ASSERT(useCount == 0); int lengthForLevel = 0; if (level == llcCaret) { lengthForLevel = 1; } else if (level == llcPage) { lengthForLevel = linesOnScreen + 1; } else if (level == llcDocument) { lengthForLevel = linesInDoc; } if (lengthForLevel > size) { Deallocate(); Allocate(lengthForLevel); } else { if (lengthForLevel < length) { for (int i = lengthForLevel; i < length; i++) { delete cache[i]; cache[i] = 0; } } length = lengthForLevel; } PLATFORM_ASSERT(length == lengthForLevel); PLATFORM_ASSERT(cache != NULL || length == 0); } void LineLayoutCache::Deallocate() { PLATFORM_ASSERT(useCount == 0); for (int i = 0; i < length; i++) delete cache[i]; delete []cache; cache = 0; length = 0; size = 0; } void LineLayoutCache::Invalidate(LineLayout::validLevel validity_) { if (cache && !allInvalidated) { for (int i = 0; i < length; i++) { if (cache[i]) { cache[i]->Invalidate(validity_); } } if (validity_ == LineLayout::llInvalid) { allInvalidated = true; } } } void LineLayoutCache::SetLevel(int level_) { allInvalidated = false; if ((level_ != -1) && (level != level_)) { level = level_; Deallocate(); } } LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, int linesOnScreen, int linesInDoc) { AllocateForLevel(linesOnScreen, linesInDoc); if (styleClock != styleClock_) { Invalidate(LineLayout::llCheckTextAndStyle); styleClock = styleClock_; } allInvalidated = false; int pos = -1; LineLayout *ret = 0; if (level == llcCaret) { pos = 0; } else if (level == llcPage) { if (lineNumber == lineCaret) { pos = 0; } else if (length > 1) { pos = 1 + (lineNumber % (length - 1)); } } else if (level == llcDocument) { pos = lineNumber; } if (pos >= 0) { PLATFORM_ASSERT(useCount == 0); if (cache && (pos < length)) { if (cache[pos]) { if ((cache[pos]->lineNumber != lineNumber) || (cache[pos]->maxLineLength < maxChars)) { delete cache[pos]; cache[pos] = 0; } } if (!cache[pos]) { cache[pos] = new LineLayout(maxChars); } if (cache[pos]) { cache[pos]->lineNumber = lineNumber; cache[pos]->inCache = true; ret = cache[pos]; useCount++; } } } if (!ret) { ret = new LineLayout(maxChars); ret->lineNumber = lineNumber; } return ret; } void LineLayoutCache::Dispose(LineLayout *ll) { allInvalidated = false; if (ll) { if (!ll->inCache) { delete ll; } else { useCount--; } } } void BreakFinder::Insert(int val) { if (val > nextBreak) { for (unsigned int j = 0; jk; k--) { selAndEdge[k] = selAndEdge[k-1]; } saeLen++; selAndEdge[j] = val; return; } } // Not less than any so append selAndEdge[saeLen++] = val; } } BreakFinder::BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, int xStart) : ll(ll_), lineStart(lineStart_), lineEnd(lineEnd_), posLineStart(posLineStart_), nextBreak(lineStart_), saeLen(0), saeCurrentPos(0), saeNext(0), subBreak(-1) { for (unsigned int j=0; j < sizeof(selAndEdge) / sizeof(selAndEdge[0]); j++) { selAndEdge[j] = 0; } // Search for first visible break // First find the first visible character nextBreak = ll->FindBefore(xStart, lineStart, lineEnd); // Now back to a style break while ((nextBreak > lineStart) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) { nextBreak--; } if (ll->selStart != ll->selEnd) { Insert(ll->selStart - posLineStart - 1); Insert(ll->selEnd - posLineStart - 1); } Insert(ll->edgeColumn - 1); Insert(lineEnd - 1); saeNext = (saeLen > 0) ? selAndEdge[0] : -1; } int BreakFinder::First() { return nextBreak; } int BreakFinder::Next() { if (subBreak == -1) { int prev = nextBreak; while (nextBreak < lineEnd) { if ((ll->styles[nextBreak] != ll->styles[nextBreak + 1]) || (nextBreak == saeNext) || IsControlCharacter(ll->chars[nextBreak]) || IsControlCharacter(ll->chars[nextBreak + 1])) { if (nextBreak == saeNext) { saeCurrentPos++; saeNext = (saeLen > saeCurrentPos) ? selAndEdge[saeCurrentPos] : -1; } nextBreak++; if ((nextBreak - prev) < lengthStartSubdivision) { return nextBreak; } break; } nextBreak++; } if ((nextBreak - prev) < lengthStartSubdivision) { return nextBreak; } subBreak = prev; } // Splitting up a long run from prev to nextBreak in lots of approximately lengthEachSubdivision. // For very long runs add extra breaks after spaces or if no spaces before low punctuation. if ((nextBreak - subBreak) <= lengthEachSubdivision) { subBreak = -1; return nextBreak; } else { int lastGoodBreak = -1; int lastOKBreak = -1; int j; for (j = subBreak + 1; j <= nextBreak; j++) { if (IsSpaceOrTab(ll->chars[j - 1]) && !IsSpaceOrTab(ll->chars[j])) { lastGoodBreak = j; } if (ll->chars[j] < 'A') { lastOKBreak = j; } if (((j - subBreak) >= lengthEachSubdivision) && ((lastGoodBreak >= 0) || (lastOKBreak >= 0))) { break; } } if (lastGoodBreak >= 0) { subBreak = lastGoodBreak; } else if (lastOKBreak >= 0) { subBreak = lastOKBreak; } else { subBreak = nextBreak; } if (subBreak >= nextBreak) { subBreak = -1; return nextBreak; } else { return subBreak; } } } PositionCacheEntry::PositionCacheEntry() : styleNumber(0), len(0), clock(0), positions(0) { } void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_, unsigned int clock_) { Clear(); styleNumber = styleNumber_; len = len_; clock = clock_; if (s_ && positions_) { positions = new short[len + (len + 1) / 2]; for (unsigned int i=0;i(positions_[i]); } memcpy(reinterpret_cast(positions + len), s_, len); } } PositionCacheEntry::~PositionCacheEntry() { Clear(); } void PositionCacheEntry::Clear() { delete []positions; positions = 0; styleNumber = 0; len = 0; clock = 0; } bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const { if ((styleNumber == styleNumber_) && (len == len_) && (memcmp(reinterpret_cast(positions + len), s_, len)== 0)) { for (unsigned int i=0;i other.clock; } void PositionCacheEntry::ResetClock() { if (clock > 0) { clock = 1; } } PositionCache::PositionCache() { size = 0x400; clock = 1; pces = new PositionCacheEntry[size]; allClear = true; } PositionCache::~PositionCache() { Clear(); delete []pces; } void PositionCache::Clear() { if (!allClear) { for (size_t i=0;i 0) && (len < 30)) { // Only store short strings in the cache so it doesn't churn with // long comments with only a single comment. // Two way associative: try two probe positions. int hashValue = PositionCacheEntry::Hash(styleNumber, s, len); probe = hashValue % size; if (pces[probe].Retrieve(styleNumber, s, len, positions)) { return; } int probe2 = (hashValue * 37) % size; if (pces[probe2].Retrieve(styleNumber, s, len, positions)) { return; } // Not found. Choose the oldest of the two slots to replace if (pces[probe].NewerThan(pces[probe2])) { probe = probe2; } } surface->MeasureWidths(vstyle.styles[styleNumber].font, s, len, positions); if (probe >= 0) { clock++; if (clock > 60000) { // Since there are only 16 bits for the clock, wrap it round and // reset all cache entries so none get stuck with a high clock. for (size_t i=0;i /* This is the Lexer for Gui4Cli, included in SciLexer.dll - by d. Keletsekis, 2/10/2003 To add to SciLexer.dll: 1. Add the values below to INCLUDE\Scintilla.iface 2. Run the include/HFacer.py script 3. Run the src/lexGen.py script val SCE_GC_DEFAULT=0 val SCE_GC_COMMENTLINE=1 val SCE_GC_COMMENTBLOCK=2 val SCE_GC_GLOBAL=3 val SCE_GC_EVENT=4 val SCE_GC_ATTRIBUTE=5 val SCE_GC_CONTROL=6 val SCE_GC_COMMAND=7 val SCE_GC_STRING=8 val SCE_GC_OPERATOR=9 */ #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif #define debug Platform::DebugPrintf static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch =='\\'); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); } inline bool isGCOperator(int ch) { if (isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '%' || ch == '[' || ch == ']' || ch == '<' || ch == '>' || ch == ',' || ch == ';' || ch == ':') return true; return false; } #define isSpace(x) ((x)==' ' || (x)=='\t') #define isNL(x) ((x)=='\n' || (x)=='\r') #define isSpaceOrNL(x) (isSpace(x) || isNL(x)) #define BUFFSIZE 500 #define isFoldPoint(x) ((styler.LevelAt(x) & SC_FOLDLEVELNUMBERMASK) == 1024) static void colorFirstWord(WordList *keywordlists[], Accessor &styler, StyleContext *sc, char *buff, int length, int) { int c = 0; while (sc->More() && isSpaceOrNL(sc->ch)) { sc->Forward(); } styler.ColourTo(sc->currentPos - 1, sc->state); if (!IsAWordChar(sc->ch)) // comment, marker, etc.. return; while (sc->More() && !isSpaceOrNL(sc->ch) && (c < length-1) && !isGCOperator(sc->ch)) { buff[c] = static_cast(sc->ch); ++c; sc->Forward(); } buff[c] = '\0'; char *p = buff; while (*p) // capitalize.. { if (islower(*p)) *p = static_cast(toupper(*p)); ++p; } WordList &kGlobal = *keywordlists[0]; // keyword lists set by the user WordList &kEvent = *keywordlists[1]; WordList &kAttribute = *keywordlists[2]; WordList &kControl = *keywordlists[3]; WordList &kCommand = *keywordlists[4]; int state = 0; // int level = styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK; // debug ("line = %d, level = %d", line, level); if (kGlobal.InList(buff)) state = SCE_GC_GLOBAL; else if (kAttribute.InList(buff)) state = SCE_GC_ATTRIBUTE; else if (kControl.InList(buff)) state = SCE_GC_CONTROL; else if (kCommand.InList(buff)) state = SCE_GC_COMMAND; else if (kEvent.InList(buff)) state = SCE_GC_EVENT; if (state) { sc->ChangeState(state); styler.ColourTo(sc->currentPos - 1, sc->state); sc->ChangeState(SCE_GC_DEFAULT); } else { sc->ChangeState(SCE_GC_DEFAULT); styler.ColourTo(sc->currentPos - 1, sc->state); } } // Main colorizing function called by Scintilla static void ColouriseGui4CliDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { styler.StartAt(startPos); int quotestart = 0, oldstate, currentline = styler.GetLine(startPos); styler.StartSegment(startPos); bool noforward; char buff[BUFFSIZE+1]; // buffer for command name StyleContext sc(startPos, length, initStyle, styler); buff[0] = '\0'; // cbuff = 0; if (sc.state != SCE_GC_COMMENTBLOCK) // colorize 1st word.. colorFirstWord(keywordlists, styler, &sc, buff, BUFFSIZE, currentline); while (sc.More()) { noforward = 0; switch (sc.ch) { case '/': if (sc.state == SCE_GC_COMMENTBLOCK || sc.state == SCE_GC_STRING) break; if (sc.chNext == '/') // line comment { sc.SetState (SCE_GC_COMMENTLINE); sc.Forward(); styler.ColourTo(sc.currentPos, sc.state); } else if (sc.chNext == '*') // block comment { sc.SetState(SCE_GC_COMMENTBLOCK); sc.Forward(); styler.ColourTo(sc.currentPos, sc.state); } else styler.ColourTo(sc.currentPos, sc.state); break; case '*': // end of comment block, or operator.. if (sc.state == SCE_GC_STRING) break; if (sc.state == SCE_GC_COMMENTBLOCK && sc.chNext == '/') { sc.Forward(); styler.ColourTo(sc.currentPos, sc.state); sc.ChangeState (SCE_GC_DEFAULT); } else styler.ColourTo(sc.currentPos, sc.state); break; case '\'': case '\"': // strings.. if (sc.state == SCE_GC_COMMENTBLOCK || sc.state == SCE_GC_COMMENTLINE) break; if (sc.state == SCE_GC_STRING) { if (sc.ch == quotestart) // match same quote char.. { styler.ColourTo(sc.currentPos, sc.state); sc.ChangeState(SCE_GC_DEFAULT); quotestart = 0; } } else { styler.ColourTo(sc.currentPos - 1, sc.state); sc.ChangeState(SCE_GC_STRING); quotestart = sc.ch; } break; case ';': // end of commandline character if (sc.state != SCE_GC_COMMENTBLOCK && sc.state != SCE_GC_COMMENTLINE && sc.state != SCE_GC_STRING) { styler.ColourTo(sc.currentPos - 1, sc.state); styler.ColourTo(sc.currentPos, SCE_GC_OPERATOR); sc.ChangeState(SCE_GC_DEFAULT); sc.Forward(); colorFirstWord(keywordlists, styler, &sc, buff, BUFFSIZE, currentline); noforward = 1; // don't move forward - already positioned at next char.. } break; case '+': case '-': case '=': case '!': // operators.. case '<': case '>': case '&': case '|': case '$': if (sc.state != SCE_GC_COMMENTBLOCK && sc.state != SCE_GC_COMMENTLINE && sc.state != SCE_GC_STRING) { styler.ColourTo(sc.currentPos - 1, sc.state); styler.ColourTo(sc.currentPos, SCE_GC_OPERATOR); sc.ChangeState(SCE_GC_DEFAULT); } break; case '\\': // escape - same as operator, but also mark in strings.. if (sc.state != SCE_GC_COMMENTBLOCK && sc.state != SCE_GC_COMMENTLINE) { oldstate = sc.state; styler.ColourTo(sc.currentPos - 1, sc.state); sc.Forward(); // mark also the next char.. styler.ColourTo(sc.currentPos, SCE_GC_OPERATOR); sc.ChangeState(oldstate); } break; case '\n': case '\r': ++currentline; if (sc.state == SCE_GC_COMMENTLINE) { styler.ColourTo(sc.currentPos, sc.state); sc.ChangeState (SCE_GC_DEFAULT); } else if (sc.state != SCE_GC_COMMENTBLOCK) { colorFirstWord(keywordlists, styler, &sc, buff, BUFFSIZE, currentline); noforward = 1; // don't move forward - already positioned at next char.. } break; // case ' ': case '\t': // default : } if (!noforward) sc.Forward(); } sc.Complete(); } // Main folding function called by Scintilla - (based on props (.ini) files function) static void FoldGui4Cli(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); bool headerPoint = false; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler[i+1]; int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_GC_EVENT || style == SCE_GC_GLOBAL) { headerPoint = true; // fold at events and globals } if (atEOL) { int lev = SC_FOLDLEVELBASE+1; if (headerPoint) lev = SC_FOLDLEVELBASE; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (headerPoint) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) // set level, if not already correct { styler.SetLevel(lineCurrent, lev); } lineCurrent++; // re-initialize our flags visibleChars = 0; headerPoint = false; } if (!(isspacechar(ch))) // || (style == SCE_GC_COMMENTLINE) || (style != SCE_GC_COMMENTBLOCK))) visibleChars++; } int lev = headerPoint ? SC_FOLDLEVELBASE : SC_FOLDLEVELBASE+1; int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, lev | flagsNext); } // I have no idea what these are for.. probably accessible by some message. static const char * const gui4cliWordListDesc[] = { "Globals", "Events", "Attributes", "Control", "Commands", 0 }; // Declare language & pass our function pointers to Scintilla LexerModule lmGui4Cli(SCLEX_GUI4CLI, ColouriseGui4CliDoc, "gui4cli", FoldGui4Cli, gui4cliWordListDesc); #undef debug sqliteman-1.2.2/sqliteman/qscintilla2/src/ScintillaBase.h0000644000175000001440000000523411407213302023015 0ustar subzerousers// Scintilla source code edit control /** @file ScintillaBase.h ** Defines an enhanced subclass of Editor with calltips, autocomplete and context menu. **/ // Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef SCINTILLABASE_H #define SCINTILLABASE_H #ifdef SCI_NAMESPACE namespace Scintilla { #endif /** */ class ScintillaBase : public Editor { // Private so ScintillaBase objects can not be copied ScintillaBase(const ScintillaBase &) : Editor() {} ScintillaBase &operator=(const ScintillaBase &) { return *this; } protected: /** Enumeration of commands and child windows. */ enum { idCallTip=1, idAutoComplete=2, idcmdUndo=10, idcmdRedo=11, idcmdCut=12, idcmdCopy=13, idcmdPaste=14, idcmdDelete=15, idcmdSelectAll=16 }; bool displayPopupMenu; Menu popup; AutoComplete ac; CallTip ct; int listType; ///< 0 is an autocomplete list SString listSelected; ///< Receives listbox selected string int maxListWidth; /// Maximum width of list, in average character widths bool performingStyle; ///< Prevent reentrance #ifdef SCI_LEXER int lexLanguage; const LexerModule *lexCurrent; PropSet props; enum {numWordLists=KEYWORDSET_MAX+1}; WordList *keyWordLists[numWordLists+1]; void SetLexer(uptr_t wParam); void SetLexerLanguage(const char *languageName); void Colourise(int start, int end); #endif ScintillaBase(); virtual ~ScintillaBase(); virtual void Initialise() = 0; virtual void Finalise() = 0; virtual void RefreshColourPalette(Palette &pal, bool want); virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); void Command(int cmdId); virtual void CancelModes(); virtual int KeyCommand(unsigned int iMessage); void AutoCompleteStart(int lenEntered, const char *list); void AutoCompleteCancel(); void AutoCompleteMove(int delta); int AutoCompleteGetCurrent(); void AutoCompleteCharacterAdded(char ch); void AutoCompleteCharacterDeleted(); void AutoCompleteCompleted(); void AutoCompleteMoveToCurrentWord(); static void AutoCompleteDoubleClick(void* p); void CallTipClick(); void CallTipShow(Point pt, const char *defn); virtual void CreateCallTipWindow(PRectangle rc) = 0; virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0; void ContextMenu(Point pt); virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); virtual void NotifyStyleToNeeded(int endStyleNeeded); public: // Public so scintilla_send_message can use it virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); }; #ifdef SCI_NAMESPACE } #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/ExternalLexer.h0000644000175000001440000000566011407213302023065 0ustar subzerousers// Scintilla source code edit control /** @file ExternalLexer.h ** Support external lexers in DLLs. **/ // Copyright 2001 Simon Steele , portions copyright Neil Hodgson. // The License.txt file describes the conditions under which this software may be distributed. #ifndef EXTERNALLEXER_H #define EXTERNALLEXER_H #if PLAT_WIN #define EXT_LEXER_DECL __stdcall #elif PLAT_QT #include #if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) #define EXT_LEXER_DECL __stdcall #else #define EXT_LEXER_DECL #endif #else #define EXT_LEXER_DECL #endif #ifdef SCI_NAMESPACE namespace Scintilla { #endif // External Lexer function definitions... typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, char *words[], WindowID window, char *props); typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, char *words[], WindowID window, char *props); typedef void* (EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); //class DynamicLibrary; /// Sub-class of LexerModule to use an external lexer. class ExternalLexerModule : protected LexerModule { protected: ExtLexerFunction fneLexer; ExtFoldFunction fneFolder; int externalLanguage; char name[100]; public: ExternalLexerModule(int language_, LexerFunction fnLexer_, const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ strncpy(name, languageName_, sizeof(name)); languageName = name; }; virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const; virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const; virtual void SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index); }; /// LexerMinder points to an ExternalLexerModule - so we don't leak them. class LexerMinder { public: ExternalLexerModule *self; LexerMinder *next; }; /// LexerLibrary exists for every External Lexer DLL, contains LexerMinders. class LexerLibrary { DynamicLibrary *lib; LexerMinder *first; LexerMinder *last; public: LexerLibrary(const char* ModuleName); ~LexerLibrary(); void Release(); LexerLibrary *next; SString m_sModuleName; }; /// LexerManager manages external lexers, contains LexerLibrarys. class LexerManager { public: ~LexerManager(); static LexerManager *GetInstance(); static void DeleteInstance(); void Load(const char* path); void Clear(); private: LexerManager(); static LexerManager *theInstance; void LoadLexerLibrary(const char* module); LexerLibrary *first; LexerLibrary *last; }; class LMMinder { public: ~LMMinder(); }; #ifdef SCI_NAMESPACE } #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/LexForth.cpp0000644000175000001440000002725011407213302022370 0ustar subzerousers// Scintilla source code edit control /** @file LexCrontab.cxx ** Lexer to use with extended crontab files used by a powerful ** Windows scheduler/event monitor/automation manager nnCron. ** (http://nemtsev.eserv.ru/) **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif bool is_whitespace(int ch){ return ch == '\n' || ch == '\r' || ch == '\t' || ch == ' '; } bool is_blank(int ch){ return ch == '\t' || ch == ' '; } //#define FORTH_DEBUG #ifdef FORTH_DEBUG static FILE *f_debug; #define log(x) fputs(f_debug,x); #else #define log(x) #endif #define STATE_LOCALE #define BL ' ' static Accessor *st; static int cur_pos,pos1,pos2,pos0,lengthDoc; char *buffer; char getChar(bool is_bl){ char ch=st->SafeGetCharAt(cur_pos); if(is_bl) if(is_whitespace(ch)) ch=BL; return ch; } char getCharBL(){ char ch=st->SafeGetCharAt(cur_pos); return ch; } bool is_eol(char ch){ return ch=='\n' || ch=='\r'; } int parse(char ch, bool skip_eol){ // pos1 - start pos of word // pos2 - pos after of word // pos0 - start pos char c=0; int len; bool is_bl=ch==BL; pos0=pos1=pos2=cur_pos; for(;cur_pos9 && base>10) digit-=7; if(digit<0) return false; if(digit>=base) return false; } return true; } bool is_number(char *s){ if(strncmp(s,"0x",2)==0) return _is_number(s+2,16); return _is_number(s,10); } static void ColouriseForthDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) { st=&styler; cur_pos=startPos; lengthDoc = startPos + length; buffer = new char[length]; #ifdef FORTH_DEBUG f_debug=fopen("c:\\sci.log","at"); #endif WordList &control = *keywordLists[0]; WordList &keyword = *keywordLists[1]; WordList &defword = *keywordLists[2]; WordList &preword1 = *keywordLists[3]; WordList &preword2 = *keywordLists[4]; WordList &strings = *keywordLists[5]; // go through all provided text segment // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); while(parse(BL,true)!=0){ if(pos0!=pos1){ styler.ColourTo(pos0,SCE_FORTH_DEFAULT); styler.ColourTo(pos1-1,SCE_FORTH_DEFAULT); } if(strcmp("\\",buffer)==0){ styler.ColourTo(pos1,SCE_FORTH_COMMENT); parse(1,false); styler.ColourTo(pos2,SCE_FORTH_COMMENT); }else if(strcmp("(",buffer)==0){ styler.ColourTo(pos1,SCE_FORTH_COMMENT); parse(')',true); if(cur_pos // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif /* TODO: o _Param should be a new lexical type */ static int is_radix(int radix, int ch) { int digit; if ( 16 < radix || 2 > radix ) { return 0; } if ( isdigit(ch) ) { digit = ch - '0'; } else if ( isxdigit(ch) ) { digit = toupper(ch) - 'A' + 10; } else { return 0; } if ( digit < radix ) { return 1; } else { return 0; } } typedef enum { STATE_NULL, ATOM_UNQUOTED, ATOM_QUOTED, ATOM_FUN_NAME, NODE_NAME_UNQUOTED, NODE_NAME_QUOTED, MACRO_START, MACRO_UNQUOTED, MACRO_QUOTED, RECORD_START, RECORD_UNQUOTED, RECORD_QUOTED, NUMERAL_START, NUMERAL_SIGNED, NUMERAL_RADIX_LITERAL, NUMERAL_SPECULATIVE_MANTISSA, NUMERAL_FLOAT_MANTISSA, NUMERAL_FLOAT_EXPONENT, NUMERAL_FLOAT_SIGNED_EXPONENT, PARSE_ERROR } atom_parse_state_t; static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; styler.StartAt(startPos); StyleContext sc(startPos, length, initStyle, styler); atom_parse_state_t parse_state = STATE_NULL; int radix_digits = 0; int exponent_digits = 0; for (; sc.More(); sc.Forward()) { if ( STATE_NULL != parse_state ) { switch (parse_state) { case STATE_NULL: sc.SetState(SCE_ERLANG_DEFAULT); break; case ATOM_UNQUOTED: if ( '@' == sc.ch ){ parse_state = NODE_NAME_UNQUOTED; } else if ( !isalnum(sc.ch) && sc.ch != '_' ) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_ERLANG_KEYWORD); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else { if ( '/' == sc.ch ) { parse_state = ATOM_FUN_NAME; } else { sc.ChangeState(SCE_ERLANG_ATOM); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } } break; case ATOM_QUOTED: if ( '@' == sc.ch ){ parse_state = NODE_NAME_QUOTED; } else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { sc.ChangeState(SCE_ERLANG_ATOM); sc.ForwardSetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case ATOM_FUN_NAME: if ( !isdigit(sc.ch) ) { sc.ChangeState(SCE_ERLANG_FUNCTION_NAME); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case NODE_NAME_QUOTED: if ( '@' == sc.ch ) { sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { sc.ChangeState(SCE_ERLANG_NODE_NAME); sc.ForwardSetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case NODE_NAME_UNQUOTED: if ( '@' == sc.ch ) { sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else if ( !isalnum(sc.ch) && sc.ch != '_' ) { sc.ChangeState(SCE_ERLANG_NODE_NAME); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case RECORD_START: if ( '\'' == sc.ch ) { parse_state = RECORD_QUOTED; } else if (isalpha(sc.ch) && islower(sc.ch)) { parse_state = RECORD_UNQUOTED; } else { // error sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case RECORD_QUOTED: if ( '\'' == sc.ch && '\\' != sc.chPrev ) { sc.ChangeState(SCE_ERLANG_RECORD); sc.ForwardSetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case RECORD_UNQUOTED: if ( !isalpha(sc.ch) && '_' != sc.ch ) { sc.ChangeState(SCE_ERLANG_RECORD); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case MACRO_START: if ( '\'' == sc.ch ) { parse_state = MACRO_QUOTED; } else if (isalpha(sc.ch)) { parse_state = MACRO_UNQUOTED; } else { // error sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case MACRO_UNQUOTED: if ( !isalpha(sc.ch) && '_' != sc.ch ) { sc.ChangeState(SCE_ERLANG_MACRO); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case MACRO_QUOTED: if ( '\'' == sc.ch && '\\' != sc.chPrev ) { sc.ChangeState(SCE_ERLANG_MACRO); sc.ForwardSetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case NUMERAL_START: if ( isdigit(sc.ch) ) { radix_digits *= 10; radix_digits += sc.ch - '0'; // Assuming ASCII here! } else if ( '#' == sc.ch ) { if ( 2 > radix_digits || 16 < radix_digits) { sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else { parse_state = NUMERAL_RADIX_LITERAL; } } else if ( '.' == sc.ch && isdigit(sc.chNext)) { radix_digits = 0; parse_state = NUMERAL_FLOAT_MANTISSA; } else if ( 'e' == sc.ch || 'E' == sc.ch ) { exponent_digits = 0; parse_state = NUMERAL_FLOAT_EXPONENT; } else { radix_digits = 0; sc.ChangeState(SCE_ERLANG_NUMBER); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case NUMERAL_RADIX_LITERAL: if ( !is_radix(radix_digits,sc.ch) ) { radix_digits = 0; if ( !isalnum(sc.ch) ) { sc.ChangeState(SCE_ERLANG_NUMBER); } sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case NUMERAL_FLOAT_MANTISSA: if ( 'e' == sc.ch || 'E' == sc.ch ) { exponent_digits = 0; parse_state = NUMERAL_FLOAT_EXPONENT; } else if ( !isdigit(sc.ch) ) { sc.ChangeState(SCE_ERLANG_NUMBER); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } break; case NUMERAL_FLOAT_EXPONENT: if ( '-' == sc.ch || '+' == sc.ch ) { parse_state = NUMERAL_FLOAT_SIGNED_EXPONENT; } else if ( !isdigit(sc.ch) ) { if ( 0 < exponent_digits ) { sc.ChangeState(SCE_ERLANG_NUMBER); } sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else { ++exponent_digits; } break; case NUMERAL_FLOAT_SIGNED_EXPONENT: if ( !isdigit(sc.ch) ) { if ( 0 < exponent_digits ) { sc.ChangeState(SCE_ERLANG_NUMBER); } sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else { ++exponent_digits; } break; case NUMERAL_SIGNED: if ( !isdigit(sc.ch) ) { sc.ChangeState(SCE_ERLANG_NUMBER); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else if ( '.' == sc.ch ) { parse_state = NUMERAL_FLOAT_MANTISSA; } break; case NUMERAL_SPECULATIVE_MANTISSA: if ( !isdigit(sc.ch) ) { sc.ChangeState(SCE_ERLANG_OPERATOR); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else { parse_state = NUMERAL_FLOAT_MANTISSA; } break; case PARSE_ERROR: sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; break; } } else if (sc.state == SCE_ERLANG_OPERATOR) { if (sc.chPrev == '.') { if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' || sc.ch == '^') { sc.ForwardSetState(SCE_ERLANG_DEFAULT); } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_ERLANG_DEFAULT); } else { sc.SetState(SCE_ERLANG_DEFAULT); } } else { sc.SetState(SCE_ERLANG_DEFAULT); } } else if (sc.state == SCE_ERLANG_VARIABLE) { if (!isalnum(sc.ch) && sc.ch != '_') { sc.SetState(SCE_ERLANG_DEFAULT); } } else if (sc.state == SCE_ERLANG_STRING) { if (sc.ch == '\"' && sc.chPrev != '\\') { sc.ForwardSetState(SCE_ERLANG_DEFAULT); } } else if (sc.state == SCE_ERLANG_COMMENT ) { if (sc.atLineEnd) { sc.SetState(SCE_ERLANG_DEFAULT); } } else if (sc.state == SCE_ERLANG_CHARACTER ) { if ( sc.chPrev == '\\' ) { sc.ForwardSetState(SCE_ERLANG_DEFAULT); } else if ( sc.ch != '\\' ) { sc.ForwardSetState(SCE_ERLANG_DEFAULT); } } if (sc.state == SCE_ERLANG_DEFAULT) { if (sc.ch == '%') { sc.SetState(SCE_ERLANG_COMMENT); } else if (sc.ch == '\"') { sc.SetState(SCE_ERLANG_STRING); } else if (sc.ch == '#') { parse_state = RECORD_START; sc.SetState(SCE_ERLANG_UNKNOWN); } else if (sc.ch == '?') { parse_state = MACRO_START; sc.SetState(SCE_ERLANG_UNKNOWN); } else if (sc.ch == '$') { sc.SetState(SCE_ERLANG_CHARACTER); } else if (sc.ch == '\'') { parse_state = ATOM_QUOTED; sc.SetState(SCE_ERLANG_UNKNOWN); } else if ( isdigit(sc.ch) ) { parse_state = NUMERAL_START; radix_digits = sc.ch - '0'; sc.SetState(SCE_ERLANG_UNKNOWN); } else if ( '.' == sc.ch ) { parse_state = NUMERAL_SPECULATIVE_MANTISSA; sc.SetState(SCE_ERLANG_UNKNOWN); } else if (isalpha(sc.ch) && isupper(sc.ch)) { sc.SetState(SCE_ERLANG_VARIABLE); } else if (isalpha(sc.ch)) { parse_state = ATOM_UNQUOTED; sc.SetState(SCE_ERLANG_UNKNOWN); } else if (isoperator(static_cast(sc.ch)) || sc.ch == '\\') { sc.SetState(SCE_ERLANG_OPERATOR); } } } sc.Complete(); } static int ClassifyFoldPointErlang( Accessor &styler, int styleNext, int keyword_start ) { int lev = 0; if ( styler.Match(keyword_start,"case") || ( styler.Match(keyword_start,"fun") && SCE_ERLANG_FUNCTION_NAME != styleNext) || styler.Match(keyword_start,"if") || styler.Match(keyword_start,"query") || styler.Match(keyword_start,"receive") ) { ++lev; } else if ( styler.Match(keyword_start,"end") ) { --lev; } return lev; } static void FoldErlangDoc( unsigned int startPos, int length, int initStyle, WordList** /*keywordlists*/, Accessor &styler ) { unsigned int endPos = startPos + length; //~ int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler.SafeGetCharAt(startPos); int styleNext = styler.StyleAt(startPos); int style = initStyle; int keyword_start = 0; bool fold_keywords = true; bool fold_comments = true; bool fold_braces = true; bool fold_function_clauses = false; bool fold_clauses = false; //int clause_level = 0; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if ( (stylePrev != SCE_ERLANG_KEYWORD) && (style == SCE_ERLANG_KEYWORD) ) { keyword_start = i; } if ( fold_keywords ) { if ( (stylePrev == SCE_ERLANG_KEYWORD) && (style != SCE_ERLANG_KEYWORD) && (style != SCE_ERLANG_ATOM) ) { levelCurrent += ClassifyFoldPointErlang(styler,styleNext,keyword_start); } } if ( fold_comments ) { if (style == SCE_ERLANG_COMMENT) { if ((ch == '%') && (chNext == '{')) { levelCurrent++; } else if ((ch == '%') && (chNext == '}')) { levelCurrent--; } } } if ( fold_function_clauses ) { if ( (SC_FOLDLEVELBASE == levelCurrent) /*&& (style == SCE_ERLANG_OPERATOR)*/ ) { if ( (ch == '-') && (chNext == '>')) { //~ fprintf(stderr,"levelCurrent=%d\n", levelCurrent); //++clause_level; //~ if ( 0 < clause_level ) ++levelCurrent; } } //~ if ( (stylePrev != SCE_ERLANG_RECORD) //~ && (style != SCE_ERLANG_NUMBER) //~ && (style != SCE_ERLANG_STRING) //~ && (style != SCE_ERLANG_COMMENT) //~ ) { if ( (SC_FOLDLEVELBASE+1 == levelCurrent) && (ch == '.') ) { //--clause_level; //~ if ( 0 == clause_level ) --levelCurrent; } //~ } } if ( fold_clauses ) { if ( (0 < levelCurrent) && (style == SCE_ERLANG_OPERATOR) ) { if ((ch == '-') && (chNext == '>')) { levelCurrent++; } if ( (ch == ';') ) { levelCurrent--; } } if ( (stylePrev != SCE_ERLANG_RECORD) && (style != SCE_ERLANG_NUMBER) && (style != SCE_ERLANG_STRING) && (style != SCE_ERLANG_COMMENT) ) { if ( (ch == '.') ) { levelCurrent--; } } if ( (stylePrev == SCE_ERLANG_KEYWORD) && (style != SCE_ERLANG_KEYWORD) && (style != SCE_ERLANG_ATOM) && ( styler.Match(keyword_start,"end") // 'end' counted twice if fold_keywords too || styler.Match(keyword_start,"after") ) ) { levelCurrent--; } } if ( fold_braces ) { if (style == SCE_ERLANG_OPERATOR) { if ( (ch == '{') || (ch == '(') || (ch == '[') ) { levelCurrent++; } else if ( (ch == '}') || (ch == ')') || (ch == ']') ) { levelCurrent--; } } } if (atEOL) { int lev = levelPrev; //~ if (visibleChars == 0 && foldCompact) //~ lev |= SC_FOLDLEVELWHITEFLAG; //~ if ((levelCurrent > levelPrev) && (visibleChars > 0)) if ((levelCurrent > levelPrev)) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; //~ visibleChars = 0; } //~ if (!isspacechar(ch)) //~ visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const erlangWordListDesc[] = { "Keywords", 0 }; LexerModule lmErlang( SCLEX_ERLANG, ColouriseErlangDoc, "erlang", FoldErlangDoc, erlangWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/LexCPP.cpp0000644000175000001440000003311611407213302021726 0ustar subzerousers// Scintilla source code edit control /** @file LexCPP.cxx ** Lexer for C++, C, Java, and JavaScript. **/ // Copyright 1998-2005 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #include "CharacterSet.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static bool IsSpaceEquiv(int state) { return (state <= SCE_C_COMMENTDOC) || // including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE (state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) || (state == SCE_C_COMMENTDOCKEYWORDERROR); } static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler, bool caseSensitive) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0; CharacterSet setOKBeforeRE(CharacterSet::setNone, "(=,"); CharacterSet setDoxygen(CharacterSet::setLower, "$@\\&<>#{}[]"); CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) { setWordStart.Add('$'); setWord.Add('$'); } int chPrevNonWhite = ' '; int visibleChars = 0; bool lastWordWasUUID = false; int styleBeforeDCKeyword = SCE_C_DEFAULT; bool continuationLine = false; if (initStyle == SCE_C_PREPROCESSOR) { // Set continuationLine if last character of previous line is '\' int lineCurrent = styler.GetLine(startPos); if (lineCurrent > 0) { int chBack = styler.SafeGetCharAt(startPos-1, 0); int chBack2 = styler.SafeGetCharAt(startPos-2, 0); int lineEndChar = '!'; if (chBack2 == '\r' && chBack == '\n') { lineEndChar = styler.SafeGetCharAt(startPos-3, 0); } else if (chBack == '\n' || chBack == '\r') { lineEndChar = chBack2; } continuationLine = lineEndChar == '\\'; } } // look back to set chPrevNonWhite properly for better regex colouring if (startPos > 0) { int back = startPos; while (--back && IsSpaceEquiv(styler.StyleAt(back))) ; if (styler.StyleAt(back) == SCE_C_OPERATOR) { chPrevNonWhite = styler.SafeGetCharAt(back); } } StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { if (sc.state == SCE_C_STRING) { // Prevent SCE_C_STRINGEOL from leaking back to previous line which // ends with a line continuation by locking in the state upto this position. sc.SetState(SCE_C_STRING); } // Reset states to begining of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; lastWordWasUUID = false; } // Handle line continuation generically. if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continuationLine = true; continue; } } // Determine if the current state should terminate. switch (sc.state) { case SCE_C_OPERATOR: sc.SetState(SCE_C_DEFAULT); break; case SCE_C_NUMBER: // We accept almost anything because of hex. and number suffixes if (!setWord.Contains(sc.ch)) { sc.SetState(SCE_C_DEFAULT); } break; case SCE_C_IDENTIFIER: if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { char s[1000]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); } else { sc.GetCurrentLowered(s, sizeof(s)); } if (keywords.InList(s)) { lastWordWasUUID = strcmp(s, "uuid") == 0; sc.ChangeState(SCE_C_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_C_WORD2); } else if (keywords4.InList(s)) { sc.ChangeState(SCE_C_GLOBALCLASS); } sc.SetState(SCE_C_DEFAULT); } break; case SCE_C_PREPROCESSOR: if (sc.atLineStart && !continuationLine) { sc.SetState(SCE_C_DEFAULT); } else if (stylingWithinPreprocessor) { if (IsASpace(sc.ch)) { sc.SetState(SCE_C_DEFAULT); } } else { if (sc.Match('/', '*') || sc.Match('/', '/')) { sc.SetState(SCE_C_DEFAULT); } } break; case SCE_C_COMMENT: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT); } break; case SCE_C_COMMENTDOC: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = SCE_C_COMMENTDOC; sc.SetState(SCE_C_COMMENTDOCKEYWORD); } } break; case SCE_C_COMMENTLINE: if (sc.atLineStart) { sc.SetState(SCE_C_DEFAULT); } break; case SCE_C_COMMENTLINEDOC: if (sc.atLineStart) { sc.SetState(SCE_C_DEFAULT); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC; sc.SetState(SCE_C_COMMENTDOCKEYWORD); } } break; case SCE_C_COMMENTDOCKEYWORD: if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) { sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT); } else if (!setDoxygen.Contains(sc.ch)) { char s[100]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); } else { sc.GetCurrentLowered(s, sizeof(s)); } if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); } sc.SetState(styleBeforeDCKeyword); } break; case SCE_C_STRING: if (sc.atLineEnd) { sc.ChangeState(SCE_C_STRINGEOL); } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_C_DEFAULT); } break; case SCE_C_CHARACTER: if (sc.atLineEnd) { sc.ChangeState(SCE_C_STRINGEOL); } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_C_DEFAULT); } break; case SCE_C_REGEX: if (sc.atLineStart) { sc.SetState(SCE_C_DEFAULT); } else if (sc.ch == '/') { sc.Forward(); while ((sc.ch < 0x80) && islower(sc.ch)) sc.Forward(); // gobble regex flags sc.SetState(SCE_C_DEFAULT); } else if (sc.ch == '\\') { // Gobble up the quoted character if (sc.chNext == '\\' || sc.chNext == '/') { sc.Forward(); } } break; case SCE_C_STRINGEOL: if (sc.atLineStart) { sc.SetState(SCE_C_DEFAULT); } break; case SCE_C_VERBATIM: if (sc.ch == '\"') { if (sc.chNext == '\"') { sc.Forward(); } else { sc.ForwardSetState(SCE_C_DEFAULT); } } break; case SCE_C_UUID: if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') { sc.SetState(SCE_C_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_C_DEFAULT) { if (sc.Match('@', '\"')) { sc.SetState(SCE_C_VERBATIM); sc.Forward(); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (lastWordWasUUID) { sc.SetState(SCE_C_UUID); lastWordWasUUID = false; } else { sc.SetState(SCE_C_NUMBER); } } else if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) { if (lastWordWasUUID) { sc.SetState(SCE_C_UUID); lastWordWasUUID = false; } else { sc.SetState(SCE_C_IDENTIFIER); } } else if (sc.Match('/', '*')) { if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style sc.SetState(SCE_C_COMMENTDOC); } else { sc.SetState(SCE_C_COMMENT); } sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match('/', '/')) { if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) // Support of Qt/Doxygen doc. style sc.SetState(SCE_C_COMMENTLINEDOC); else sc.SetState(SCE_C_COMMENTLINE); } else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite)) { sc.SetState(SCE_C_REGEX); // JavaScript's RegEx } else if (sc.ch == '\"') { sc.SetState(SCE_C_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_C_CHARACTER); } else if (sc.ch == '#' && visibleChars == 0) { // Preprocessor commands are alone on their line sc.SetState(SCE_C_PREPROCESSOR); // Skip whitespace between # and preprocessor word do { sc.Forward(); } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); if (sc.atLineEnd) { sc.SetState(SCE_C_DEFAULT); } } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_C_OPERATOR); } } if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) { chPrevNonWhite = sc.ch; visibleChars++; } continuationLine = false; } sc.Complete(); } static bool IsStreamCommentStyle(int style) { return style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC || style == SCE_C_COMMENTDOCKEYWORD || style == SCE_C_COMMENTDOCKEYWORDERROR; } // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_C_COMMENTLINEDOC)) { levelNext++; } else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } } if (foldComment && (style == SCE_C_COMMENTLINE)) { if ((ch == '/') && (chNext == '/')) { char chNext2 = styler.SafeGetCharAt(i + 2); if (chNext2 == '{') { levelNext++; } else if (chNext2 == '}') { levelNext--; } } } if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '#') { unsigned int j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } if (styler.Match(j, "region") || styler.Match(j, "if")) { levelNext++; } else if (styler.Match(j, "end")) { levelNext--; } } } if (style == SCE_C_OPERATOR) { if (ch == '{') { // Measure the minimum before a '{' to allow // folding on "} else {" if (levelMinCurrent > levelNext) { levelMinCurrent = levelNext; } levelNext++; } else if (ch == '}') { levelNext--; } } if (atEOL) { int levelUse = levelCurrent; if (foldAtElse) { levelUse = levelMinCurrent; } int lev = levelUse | levelNext << 16; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelCurrent = levelNext; levelMinCurrent = levelCurrent; visibleChars = 0; } if (!IsASpace(ch)) visibleChars++; } } static const char * const cppWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", "Documentation comment keywords", "Unused", "Global classes and typedefs", 0, }; static void ColouriseCppDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { ColouriseCppDoc(startPos, length, initStyle, keywordlists, styler, true); } static void ColouriseCppDocInsensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { ColouriseCppDoc(startPos, length, initStyle, keywordlists, styler, false); } LexerModule lmCPP(SCLEX_CPP, ColouriseCppDocSensitive, "cpp", FoldCppDoc, cppWordLists); LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, ColouriseCppDocInsensitive, "cppnocase", FoldCppDoc, cppWordLists); sqliteman-1.2.2/sqliteman/qscintilla2/src/StyleContext.cpp0000644000175000001440000000227211407213302023277 0ustar subzerousers// Scintilla source code edit control /** @file StyleContext.cxx ** Lexer infrastructure. **/ // Copyright 1998-2004 by Neil Hodgson // This file is in the public domain. #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static void getRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) { unsigned int i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = styler[start + i]; i++; } s[i] = '\0'; } void StyleContext::GetCurrent(char *s, unsigned int len) { getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); } static void getRangeLowered(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) { unsigned int i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast(tolower(styler[start + i])); i++; } s[i] = '\0'; } void StyleContext::GetCurrentLowered(char *s, unsigned int len) { getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); } sqliteman-1.2.2/sqliteman/qscintilla2/src/LexSpecman.cpp0000644000175000001440000002137011407213302022671 0ustar subzerousers// Scintilla source code edit control /** @file LexSpecman.cxx ** Lexer for Specman E language. ** Written by Avi Yegudin, based on C++ lexer by Neil Hodgson **/ // Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\''); } static inline bool IsANumberChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '\''); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '`'); } static void ColouriseSpecmanDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler, bool caseSensitive) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; // Do not leak onto next line if (initStyle == SCE_SN_STRINGEOL) initStyle = SCE_SN_CODE; int visibleChars = 0; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineStart && (sc.state == SCE_SN_STRING)) { // Prevent SCE_SN_STRINGEOL from leaking back to previous line sc.SetState(SCE_SN_STRING); } // Handle line continuation generically. if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate. if (sc.state == SCE_SN_OPERATOR) { sc.SetState(SCE_SN_CODE); } else if (sc.state == SCE_SN_NUMBER) { if (!IsANumberChar(sc.ch)) { sc.SetState(SCE_SN_CODE); } } else if (sc.state == SCE_SN_IDENTIFIER) { if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { char s[100]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); } else { sc.GetCurrentLowered(s, sizeof(s)); } if (keywords.InList(s)) { sc.ChangeState(SCE_SN_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_SN_WORD2); } else if (keywords3.InList(s)) { sc.ChangeState(SCE_SN_WORD3); } else if (keywords4.InList(s)) { sc.ChangeState(SCE_SN_USER); } sc.SetState(SCE_SN_CODE); } } else if (sc.state == SCE_SN_PREPROCESSOR) { if (IsASpace(sc.ch)) { sc.SetState(SCE_SN_CODE); } } else if (sc.state == SCE_SN_DEFAULT) { if (sc.Match('<', '\'')) { sc.Forward(); sc.ForwardSetState(SCE_SN_CODE); } } else if (sc.state == SCE_SN_COMMENTLINE || sc.state == SCE_SN_COMMENTLINEBANG) { if (sc.atLineEnd) { sc.SetState(SCE_SN_CODE); visibleChars = 0; } } else if (sc.state == SCE_SN_STRING) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_SN_CODE); } else if (sc.atLineEnd) { sc.ChangeState(SCE_SN_STRINGEOL); sc.ForwardSetState(SCE_SN_CODE); visibleChars = 0; } } else if (sc.state == SCE_SN_SIGNAL) { if (sc.atLineEnd) { sc.ChangeState(SCE_SN_STRINGEOL); sc.ForwardSetState(SCE_SN_CODE); visibleChars = 0; } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_SN_CODE); } } else if (sc.state == SCE_SN_REGEXTAG) { if (!IsADigit(sc.ch)) { sc.SetState(SCE_SN_CODE); } } // Determine if a new state should be entered. if (sc.state == SCE_SN_CODE) { if (sc.ch == '$' && IsADigit(sc.chNext)) { sc.SetState(SCE_SN_REGEXTAG); sc.Forward(); } else if (IsADigit(sc.ch)) { sc.SetState(SCE_SN_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_SN_IDENTIFIER); } else if (sc.Match('\'', '>')) { sc.SetState(SCE_SN_DEFAULT); sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match('/', '/')) { if (sc.Match("//!")) // Nice to have a different comment style sc.SetState(SCE_SN_COMMENTLINEBANG); else sc.SetState(SCE_SN_COMMENTLINE); } else if (sc.Match('-', '-')) { if (sc.Match("--!")) // Nice to have a different comment style sc.SetState(SCE_SN_COMMENTLINEBANG); else sc.SetState(SCE_SN_COMMENTLINE); } else if (sc.ch == '\"') { sc.SetState(SCE_SN_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_SN_SIGNAL); } else if (sc.ch == '#' && visibleChars == 0) { // Preprocessor commands are alone on their line sc.SetState(SCE_SN_PREPROCESSOR); // Skip whitespace between # and preprocessor word do { sc.Forward(); } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); if (sc.atLineEnd) { sc.SetState(SCE_SN_CODE); } } else if (isoperator(static_cast(sc.ch)) || sc.ch == '@') { sc.SetState(SCE_SN_OPERATOR); } } if (sc.atLineEnd) { // Reset states to begining of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; } if (!IsASpace(sc.ch)) { visibleChars++; } } sc.Complete(); } // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". static void FoldNoBoxSpecmanDoc(unsigned int startPos, int length, int, Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); //int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && (style == SCE_SN_COMMENTLINE)) { if (((ch == '/') && (chNext == '/')) || ((ch == '-') && (chNext == '-'))) { char chNext2 = styler.SafeGetCharAt(i + 2); if (chNext2 == '{') { levelNext++; } else if (chNext2 == '}') { levelNext--; } } } if (style == SCE_SN_OPERATOR) { if (ch == '{') { // Measure the minimum before a '{' to allow // folding on "} else {" if (levelMinCurrent > levelNext) { levelMinCurrent = levelNext; } levelNext++; } else if (ch == '}') { levelNext--; } } if (atEOL) { int levelUse = levelCurrent; if (foldAtElse) { levelUse = levelMinCurrent; } int lev = levelUse | levelNext << 16; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelCurrent = levelNext; levelMinCurrent = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } } static void FoldSpecmanDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { FoldNoBoxSpecmanDoc(startPos, length, initStyle, styler); } static const char * const specmanWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", "Sequence keywords and identifiers", "User defined keywords and identifiers", "Unused", 0, }; static void ColouriseSpecmanDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { ColouriseSpecmanDoc(startPos, length, initStyle, keywordlists, styler, true); } LexerModule lmSpecman(SCLEX_SPECMAN, ColouriseSpecmanDocSensitive, "specman", FoldSpecmanDoc, specmanWordLists); sqliteman-1.2.2/sqliteman/qscintilla2/src/AutoComplete.cpp0000644000175000001440000000735511407213302023242 0ustar subzerousers// Scintilla source code edit control /** @file AutoComplete.cxx ** Defines the auto completion list box. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include "Platform.h" #include "PropSet.h" #include "AutoComplete.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif AutoComplete::AutoComplete() : active(false), separator(' '), typesep('?'), ignoreCase(false), chooseSingle(false), lb(0), posStart(0), startLen(0), cancelAtStartPos(true), autoHide(true), dropRestOfWord(false) { lb = ListBox::Allocate(); stopChars[0] = '\0'; fillUpChars[0] = '\0'; } AutoComplete::~AutoComplete() { if (lb) { lb->Destroy(); delete lb; lb = 0; } } bool AutoComplete::Active() { return active; } void AutoComplete::Start(Window &parent, int ctrlID, int position, Point location, int startLen_, int lineHeight, bool unicodeMode) { if (active) { Cancel(); } lb->Create(parent, ctrlID, location, lineHeight, unicodeMode); lb->Clear(); active = true; startLen = startLen_; posStart = position; } void AutoComplete::SetStopChars(const char *stopChars_) { strncpy(stopChars, stopChars_, sizeof(stopChars)); stopChars[sizeof(stopChars) - 1] = '\0'; } bool AutoComplete::IsStopChar(char ch) { return ch && strchr(stopChars, ch); } void AutoComplete::SetFillUpChars(const char *fillUpChars_) { strncpy(fillUpChars, fillUpChars_, sizeof(fillUpChars)); fillUpChars[sizeof(fillUpChars) - 1] = '\0'; } bool AutoComplete::IsFillUpChar(char ch) { return ch && strchr(fillUpChars, ch); } void AutoComplete::SetSeparator(char separator_) { separator = separator_; } char AutoComplete::GetSeparator() { return separator; } void AutoComplete::SetTypesep(char separator_) { typesep = separator_; } char AutoComplete::GetTypesep() { return typesep; } void AutoComplete::SetList(const char *list) { lb->SetList(list, separator, typesep); } void AutoComplete::Show(bool show) { lb->Show(show); if (show) lb->Select(0); } void AutoComplete::Cancel() { if (lb->Created()) { lb->Clear(); lb->Destroy(); active = false; } } void AutoComplete::Move(int delta) { int count = lb->Length(); int current = lb->GetSelection(); current += delta; if (current >= count) current = count - 1; if (current < 0) current = 0; lb->Select(current); } void AutoComplete::Select(const char *word) { size_t lenWord = strlen(word); int location = -1; const int maxItemLen=1000; char item[maxItemLen]; int start = 0; // lower bound of the api array block to search int end = lb->Length() - 1; // upper bound of the api array block to search while ((start <= end) && (location == -1)) { // Binary searching loop int pivot = (start + end) / 2; lb->GetValue(pivot, item, maxItemLen); int cond; if (ignoreCase) cond = CompareNCaseInsensitive(word, item, lenWord); else cond = strncmp(word, item, lenWord); if (!cond) { // Find first match while (pivot > start) { lb->GetValue(pivot-1, item, maxItemLen); if (ignoreCase) cond = CompareNCaseInsensitive(word, item, lenWord); else cond = strncmp(word, item, lenWord); if (0 != cond) break; --pivot; } location = pivot; if (ignoreCase) { // Check for exact-case match for (; pivot <= end; pivot++) { lb->GetValue(pivot, item, maxItemLen); if (!strncmp(word, item, lenWord)) { location = pivot; break; } if (CompareNCaseInsensitive(word, item, lenWord)) break; } } } else if (cond < 0) { end = pivot - 1; } else if (cond > 0) { start = pivot + 1; } } if (location == -1 && autoHide) Cancel(); else lb->Select(location); } sqliteman-1.2.2/sqliteman/qscintilla2/src/LexCmake.cpp0000644000175000001440000003646611407213302022337 0ustar subzerousers// Scintilla source code edit control /** @file LexCmake.cxx ** Lexer for Cmake **/ // Copyright 2007 by Cristian Adam // based on the NSIS lexer // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static bool isCmakeNumber(char ch) { return(ch >= '0' && ch <= '9'); } static bool isCmakeChar(char ch) { return(ch == '.' ) || (ch == '_' ) || isCmakeNumber(ch) || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } static bool isCmakeLetter(char ch) { return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler) { int nNextLine = -1; for ( unsigned int i = start; i < end; i++ ) { char cNext = styler.SafeGetCharAt( i ); if ( cNext == '\n' ) { nNextLine = i+1; break; } } if ( nNextLine == -1 ) // We never foudn the next line... return false; for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) { char cNext = styler.SafeGetCharAt( firstChar ); if ( cNext == ' ' ) continue; if ( cNext == '\t' ) continue; if ( styler.Match(firstChar, "ELSE") || styler.Match(firstChar, "else")) return true; break; } return false; } static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse) { // If the word is too long, it is not what we are looking for if ( end - start > 20 ) return foldlevel; int newFoldlevel = foldlevel; char s[20]; // The key word we are looking for has atmost 13 characters for (unsigned int i = 0; i < end - start + 1 && i < 19; i++) { s[i] = static_cast( styler[ start + i ] ); s[i + 1] = '\0'; } if ( CompareCaseInsensitive(s, "IF") == 0 || CompareCaseInsensitive(s, "WHILE") == 0 || CompareCaseInsensitive(s, "MACRO") == 0 || CompareCaseInsensitive(s, "FOREACH") == 0 || CompareCaseInsensitive(s, "ELSEIF") == 0 ) newFoldlevel++; else if ( CompareCaseInsensitive(s, "ENDIF") == 0 || CompareCaseInsensitive(s, "ENDWHILE") == 0 || CompareCaseInsensitive(s, "ENDMACRO") == 0 || CompareCaseInsensitive(s, "ENDFOREACH") == 0) newFoldlevel--; else if ( bElse && CompareCaseInsensitive(s, "ELSEIF") == 0 ) newFoldlevel++; else if ( bElse && CompareCaseInsensitive(s, "ELSE") == 0 ) newFoldlevel++; return newFoldlevel; } static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler ) { char word[100] = {0}; char lowercaseWord[100] = {0}; WordList &Commands = *keywordLists[0]; WordList &Parameters = *keywordLists[1]; WordList &UserDefined = *keywordLists[2]; for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) { word[i] = static_cast( styler[ start + i ] ); lowercaseWord[i] = static_cast(tolower(word[i])); } // Check for special words... if ( CompareCaseInsensitive(word, "MACRO") == 0 || CompareCaseInsensitive(word, "ENDMACRO") == 0 ) return SCE_CMAKE_MACRODEF; if ( CompareCaseInsensitive(word, "IF") == 0 || CompareCaseInsensitive(word, "ENDIF") == 0 ) return SCE_CMAKE_IFDEFINEDEF; if ( CompareCaseInsensitive(word, "ELSEIF") == 0 || CompareCaseInsensitive(word, "ELSE") == 0 ) return SCE_CMAKE_IFDEFINEDEF; if ( CompareCaseInsensitive(word, "WHILE") == 0 || CompareCaseInsensitive(word, "ENDWHILE") == 0) return SCE_CMAKE_WHILEDEF; if ( CompareCaseInsensitive(word, "FOREACH") == 0 || CompareCaseInsensitive(word, "ENDFOREACH") == 0) return SCE_CMAKE_FOREACHDEF; if ( Commands.InList(lowercaseWord) ) return SCE_CMAKE_COMMANDS; if ( Parameters.InList(word) ) return SCE_CMAKE_PARAMETERS; if ( UserDefined.InList(word) ) return SCE_CMAKE_USERDEFINED; if ( strlen(word) > 3 ) { if ( word[1] == '{' && word[strlen(word)-1] == '}' ) return SCE_CMAKE_VARIABLE; } // To check for numbers if ( isCmakeNumber( word[0] ) ) { bool bHasSimpleCmakeNumber = true; for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) { if ( !isCmakeNumber( word[j] ) ) { bHasSimpleCmakeNumber = false; break; } } if ( bHasSimpleCmakeNumber ) return SCE_CMAKE_NUMBER; } return SCE_CMAKE_DEFAULT; } static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) { int state = SCE_CMAKE_DEFAULT; if ( startPos > 0 ) state = styler.StyleAt(startPos-1); // Use the style from the previous line, usually default, but could be commentbox styler.StartAt( startPos ); styler.GetLine( startPos ); unsigned int nLengthDoc = startPos + length; styler.StartSegment( startPos ); char cCurrChar; bool bVarInString = false; bool bClassicVarInString = false; unsigned int i; for ( i = startPos; i < nLengthDoc; i++ ) { cCurrChar = styler.SafeGetCharAt( i ); char cNextChar = styler.SafeGetCharAt(i+1); switch (state) { case SCE_CMAKE_DEFAULT: if ( cCurrChar == '#' ) { // we have a comment line styler.ColourTo(i-1, state ); state = SCE_CMAKE_COMMENT; break; } if ( cCurrChar == '"' ) { styler.ColourTo(i-1, state ); state = SCE_CMAKE_STRINGDQ; bVarInString = false; bClassicVarInString = false; break; } if ( cCurrChar == '\'' ) { styler.ColourTo(i-1, state ); state = SCE_CMAKE_STRINGRQ; bVarInString = false; bClassicVarInString = false; break; } if ( cCurrChar == '`' ) { styler.ColourTo(i-1, state ); state = SCE_CMAKE_STRINGLQ; bVarInString = false; bClassicVarInString = false; break; } // CMake Variable if ( cCurrChar == '$' || isCmakeChar(cCurrChar)) { styler.ColourTo(i-1,state); state = SCE_CMAKE_VARIABLE; // If it is a number, we must check and set style here first... if ( isCmakeNumber(cCurrChar) && (cNextChar == '\t' || cNextChar == ' ' || cNextChar == '\r' || cNextChar == '\n' ) ) styler.ColourTo( i, SCE_CMAKE_NUMBER); break; } break; case SCE_CMAKE_COMMENT: if ( cNextChar == '\n' || cNextChar == '\r' ) { // Special case: if ( cCurrChar == '\\' ) { styler.ColourTo(i-2,state); styler.ColourTo(i,SCE_CMAKE_DEFAULT); } else { styler.ColourTo(i,state); state = SCE_CMAKE_DEFAULT; } } break; case SCE_CMAKE_STRINGDQ: case SCE_CMAKE_STRINGLQ: case SCE_CMAKE_STRINGRQ: if ( styler.SafeGetCharAt(i-1) == '\\' && styler.SafeGetCharAt(i-2) == '$' ) break; // Ignore the next character, even if it is a quote of some sort if ( cCurrChar == '"' && state == SCE_CMAKE_STRINGDQ ) { styler.ColourTo(i,state); state = SCE_CMAKE_DEFAULT; break; } if ( cCurrChar == '`' && state == SCE_CMAKE_STRINGLQ ) { styler.ColourTo(i,state); state = SCE_CMAKE_DEFAULT; break; } if ( cCurrChar == '\'' && state == SCE_CMAKE_STRINGRQ ) { styler.ColourTo(i,state); state = SCE_CMAKE_DEFAULT; break; } if ( cNextChar == '\r' || cNextChar == '\n' ) { int nCurLine = styler.GetLine(i+1); int nBack = i; // We need to check if the previous line has a \ in it... bool bNextLine = false; while ( nBack > 0 ) { if ( styler.GetLine(nBack) != nCurLine ) break; char cTemp = styler.SafeGetCharAt(nBack, 'a'); // Letter 'a' is safe here if ( cTemp == '\\' ) { bNextLine = true; break; } if ( cTemp != '\r' && cTemp != '\n' && cTemp != '\t' && cTemp != ' ' ) break; nBack--; } if ( bNextLine ) { styler.ColourTo(i+1,state); } if ( bNextLine == false ) { styler.ColourTo(i,state); state = SCE_CMAKE_DEFAULT; } } break; case SCE_CMAKE_VARIABLE: // CMake Variable: if ( cCurrChar == '$' ) state = SCE_CMAKE_DEFAULT; else if ( cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) ) state = SCE_CMAKE_DEFAULT; else if ( (isCmakeChar(cCurrChar) && !isCmakeChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' ) { state = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler ); styler.ColourTo( i, state); state = SCE_CMAKE_DEFAULT; } else if ( !isCmakeChar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' ) { if ( classifyWordCmake( styler.GetStartSegment(), i-1, keywordLists, styler) == SCE_CMAKE_NUMBER ) styler.ColourTo( i-1, SCE_CMAKE_NUMBER ); state = SCE_CMAKE_DEFAULT; if ( cCurrChar == '"' ) { state = SCE_CMAKE_STRINGDQ; bVarInString = false; bClassicVarInString = false; } else if ( cCurrChar == '`' ) { state = SCE_CMAKE_STRINGLQ; bVarInString = false; bClassicVarInString = false; } else if ( cCurrChar == '\'' ) { state = SCE_CMAKE_STRINGRQ; bVarInString = false; bClassicVarInString = false; } else if ( cCurrChar == '#' ) { state = SCE_CMAKE_COMMENT; } } break; } if ( state == SCE_CMAKE_COMMENT) { styler.ColourTo(i,state); } else if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) { bool bIngoreNextDollarSign = false; if ( bVarInString && cCurrChar == '$' ) { bVarInString = false; bIngoreNextDollarSign = true; } else if ( bVarInString && cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' || cNextChar == '"' || cNextChar == '`' || cNextChar == '\'' ) ) { styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); bVarInString = false; bIngoreNextDollarSign = false; } else if ( bVarInString && !isCmakeChar(cNextChar) ) { int nWordState = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler); if ( nWordState == SCE_CMAKE_VARIABLE ) styler.ColourTo( i, SCE_CMAKE_STRINGVAR); bVarInString = false; } // Covers "${TEST}..." else if ( bClassicVarInString && cNextChar == '}' ) { styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); bClassicVarInString = false; } // Start of var in string if ( !bIngoreNextDollarSign && cCurrChar == '$' && cNextChar == '{' ) { styler.ColourTo( i-1, state); bClassicVarInString = true; bVarInString = false; } else if ( !bIngoreNextDollarSign && cCurrChar == '$' ) { styler.ColourTo( i-1, state); bVarInString = true; bClassicVarInString = false; } } } // Colourise remaining document styler.ColourTo(nLengthDoc-1,state); } static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { // No folding enabled, no reason to continue... if ( styler.GetPropertyInt("fold") == 0 ) return; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1; int lineCurrent = styler.GetLine(startPos); unsigned int safeStartPos = styler.LineStart( lineCurrent ); bool bArg1 = true; int nWordStart = -1; int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelNext = levelCurrent; for (unsigned int i = safeStartPos; i < startPos + length; i++) { char chCurr = styler.SafeGetCharAt(i); if ( bArg1 ) { if ( nWordStart == -1 && (isCmakeLetter(chCurr)) ) { nWordStart = i; } else if ( isCmakeLetter(chCurr) == false && nWordStart > -1 ) { int newLevel = calculateFoldCmake( nWordStart, i-1, levelNext, styler, foldAtElse); if ( newLevel == levelNext ) { if ( foldAtElse ) { if ( CmakeNextLineHasElse(i, startPos + length, styler) ) levelNext--; } } else levelNext = newLevel; bArg1 = false; } } if ( chCurr == '\n' ) { if ( bArg1 && foldAtElse) { if ( CmakeNextLineHasElse(i, startPos + length, styler) ) levelNext--; } // If we are on a new line... int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (levelUse < levelNext ) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) styler.SetLevel(lineCurrent, lev); lineCurrent++; levelCurrent = levelNext; bArg1 = true; // New line, lets look at first argument again nWordStart = -1; } } int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) styler.SetLevel(lineCurrent, lev); } static const char * const cmakeWordLists[] = { "Commands", "Parameters", "UserDefined", 0, 0,}; LexerModule lmCmake(SCLEX_CMAKE, ColouriseCmakeDoc, "cmake", FoldCmakeDoc, cmakeWordLists); sqliteman-1.2.2/sqliteman/qscintilla2/src/LexAsm.cpp0000644000175000001440000001210511407213302022017 0ustar subzerousers// Scintilla source code edit control /** @file LexAsm.cxx ** Lexer for Assembler, just for the MASM syntax ** Written by The Black Horus ** Enhancements and NASM stuff by Kein-Hong Man, 2003-10 ** SCE_ASM_COMMENTBLOCK and SCE_ASM_CHARACTER are for future GNU as colouring **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '?'); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' || ch == '%' || ch == '@' || ch == '$' || ch == '?'); } static inline bool IsAsmOperator(char ch) { if (isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '^' || ch == '[' || ch == ']' || ch == '<' || ch == '&' || ch == '>' || ch == ',' || ch == '|' || ch == '~' || ch == '%' || ch == ':') return true; return false; } static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &cpuInstruction = *keywordlists[0]; WordList &mathInstruction = *keywordlists[1]; WordList ®isters = *keywordlists[2]; WordList &directive = *keywordlists[3]; WordList &directiveOperand = *keywordlists[4]; WordList &extInstruction = *keywordlists[5]; // Do not leak onto next line if (initStyle == SCE_ASM_STRINGEOL) initStyle = SCE_ASM_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // Prevent SCE_ASM_STRINGEOL from leaking back to previous line if (sc.atLineStart && (sc.state == SCE_ASM_STRING)) { sc.SetState(SCE_ASM_STRING); } else if (sc.atLineStart && (sc.state == SCE_ASM_CHARACTER)) { sc.SetState(SCE_ASM_CHARACTER); } // Handle line continuation generically. if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate. if (sc.state == SCE_ASM_OPERATOR) { if (!IsAsmOperator(static_cast(sc.ch))) { sc.SetState(SCE_ASM_DEFAULT); } }else if (sc.state == SCE_ASM_NUMBER) { if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_ASM_DEFAULT); } } else if (sc.state == SCE_ASM_IDENTIFIER) { if (!IsAWordChar(sc.ch) ) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (cpuInstruction.InList(s)) { sc.ChangeState(SCE_ASM_CPUINSTRUCTION); } else if (mathInstruction.InList(s)) { sc.ChangeState(SCE_ASM_MATHINSTRUCTION); } else if (registers.InList(s)) { sc.ChangeState(SCE_ASM_REGISTER); } else if (directive.InList(s)) { sc.ChangeState(SCE_ASM_DIRECTIVE); } else if (directiveOperand.InList(s)) { sc.ChangeState(SCE_ASM_DIRECTIVEOPERAND); } else if (extInstruction.InList(s)) { sc.ChangeState(SCE_ASM_EXTINSTRUCTION); } sc.SetState(SCE_ASM_DEFAULT); } } else if (sc.state == SCE_ASM_COMMENT ) { if (sc.atLineEnd) { sc.SetState(SCE_ASM_DEFAULT); } } else if (sc.state == SCE_ASM_STRING) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_ASM_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_ASM_STRINGEOL); sc.ForwardSetState(SCE_ASM_DEFAULT); } } else if (sc.state == SCE_ASM_CHARACTER) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_ASM_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_ASM_STRINGEOL); sc.ForwardSetState(SCE_ASM_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_ASM_DEFAULT) { if (sc.ch == ';'){ sc.SetState(SCE_ASM_COMMENT); } else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) { sc.SetState(SCE_ASM_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_ASM_IDENTIFIER); } else if (sc.ch == '\"') { sc.SetState(SCE_ASM_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_ASM_CHARACTER); } else if (IsAsmOperator(static_cast(sc.ch))) { sc.SetState(SCE_ASM_OPERATOR); } } } sc.Complete(); } static const char * const asmWordListDesc[] = { "CPU instructions", "FPU instructions", "Registers", "Directives", "Directive operands", "Extended instructions", 0 }; LexerModule lmAsm(SCLEX_ASM, ColouriseAsmDoc, "asm", 0, asmWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/WindowAccessor.cpp0000644000175000001440000001214411407213302023563 0ustar subzerousers// Scintilla source code edit control /** @file WindowAccessor.cxx ** Rapid easy access to contents of a Scintilla. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "WindowAccessor.h" #include "Scintilla.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif WindowAccessor::~WindowAccessor() { } bool WindowAccessor::InternalIsLeadByte(char ch) { if (SC_CP_UTF8 == codePage) // For lexing, all characters >= 0x80 are treated the // same so none is considered a lead byte. return false; else return Platform::IsDBCSLeadByte(codePage, ch); } void WindowAccessor::Fill(int position) { if (lenDoc == -1) lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0); startPos = position - slopSize; if (startPos + bufferSize > lenDoc) startPos = lenDoc - bufferSize; if (startPos < 0) startPos = 0; endPos = startPos + bufferSize; if (endPos > lenDoc) endPos = lenDoc; TextRange tr = {{startPos, endPos}, buf}; Platform::SendScintillaPointer(id, SCI_GETTEXTRANGE, 0, &tr); } bool WindowAccessor::Match(int pos, const char *s) { for (int i=0; *s; i++) { if (*s != SafeGetCharAt(pos+i)) return false; s++; } return true; } char WindowAccessor::StyleAt(int position) { return static_cast(Platform::SendScintilla( id, SCI_GETSTYLEAT, position, 0)); } int WindowAccessor::GetLine(int position) { return Platform::SendScintilla(id, SCI_LINEFROMPOSITION, position, 0); } int WindowAccessor::LineStart(int line) { return Platform::SendScintilla(id, SCI_POSITIONFROMLINE, line, 0); } int WindowAccessor::LevelAt(int line) { return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0); } int WindowAccessor::Length() { if (lenDoc == -1) lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0); return lenDoc; } int WindowAccessor::GetLineState(int line) { return Platform::SendScintilla(id, SCI_GETLINESTATE, line); } int WindowAccessor::SetLineState(int line, int state) { return Platform::SendScintilla(id, SCI_SETLINESTATE, line, state); } void WindowAccessor::StartAt(unsigned int start, char chMask) { Platform::SendScintilla(id, SCI_STARTSTYLING, start, chMask); } void WindowAccessor::StartSegment(unsigned int pos) { startSeg = pos; } void WindowAccessor::ColourTo(unsigned int pos, int chAttr) { // Only perform styling if non empty range if (pos != startSeg - 1) { if (pos < startSeg) { Platform::DebugPrintf("Bad colour positions %d - %d\n", startSeg, pos); } if (validLen + (pos - startSeg + 1) >= bufferSize) Flush(); if (validLen + (pos - startSeg + 1) >= bufferSize) { // Too big for buffer so send directly Platform::SendScintilla(id, SCI_SETSTYLING, pos - startSeg + 1, chAttr); } else { if (chAttr != chWhile) chFlags = 0; chAttr |= chFlags; for (unsigned int i = startSeg; i <= pos; i++) { styleBuf[validLen++] = static_cast(chAttr); } } } startSeg = pos+1; } void WindowAccessor::SetLevel(int line, int level) { Platform::SendScintilla(id, SCI_SETFOLDLEVEL, line, level); } void WindowAccessor::Flush() { startPos = extremePosition; lenDoc = -1; if (validLen > 0) { Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen, styleBuf); validLen = 0; } } int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { int end = Length(); int spaceFlags = 0; // Determines the indentation level of the current line and also checks for consistent // indentation compared to the previous line. // Indentation is judged consistent when the indentation whitespace of each line lines // the same or the indentation of one line is a prefix of the other. int pos = LineStart(line); char ch = (*this)[pos]; int indent = 0; bool inPrevPrefix = line > 0; int posPrev = inPrevPrefix ? LineStart(line-1) : 0; while ((ch == ' ' || ch == '\t') && (pos < end)) { if (inPrevPrefix) { char chPrev = (*this)[posPrev++]; if (chPrev == ' ' || chPrev == '\t') { if (chPrev != ch) spaceFlags |= wsInconsistent; } else { inPrevPrefix = false; } } if (ch == ' ') { spaceFlags |= wsSpace; indent++; } else { // Tab spaceFlags |= wsTab; if (spaceFlags & wsSpace) spaceFlags |= wsSpaceTab; indent = (indent / 8 + 1) * 8; } ch = (*this)[++pos]; } *flags = spaceFlags; indent += SC_FOLDLEVELBASE; // if completely empty line or the start of a comment... if (isspace(ch) || (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) return indent | SC_FOLDLEVELWHITEFLAG; else return indent; } void WindowAccessor::IndicatorFill(int start, int end, int indicator, int value) { Platform::SendScintilla(id, SCI_SETINDICATORCURRENT, indicator); if (value) { Platform::SendScintilla(id, SCI_SETINDICATORVALUE, value); Platform::SendScintilla(id, SCI_INDICATORFILLRANGE, start, end - start); } else { Platform::SendScintilla(id, SCI_INDICATORCLEARRANGE, start, end - start); } } sqliteman-1.2.2/sqliteman/qscintilla2/src/ExternalLexer.cpp0000644000175000001440000001363011407213302023414 0ustar subzerousers// Scintilla source code edit control /** @file ExternalLexer.cxx ** Support external lexers in DLLs. **/ // Copyright 2001 Simon Steele , portions copyright Neil Hodgson. // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include "Platform.h" #include "Scintilla.h" #include "SciLexer.h" #include "PropSet.h" #include "Accessor.h" #include "DocumentAccessor.h" #include "KeyWords.h" #include "ExternalLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif LexerManager *LexerManager::theInstance = NULL; //------------------------------------------ // // ExternalLexerModule // //------------------------------------------ char **WordListsToStrings(WordList *val[]) { int dim = 0; while (val[dim]) dim++; char **wls = new char * [dim + 1]; for (int i = 0;i < dim;i++) { SString words; words = ""; for (int n = 0; n < val[i]->len; n++) { words += val[i]->words[n]; if (n != val[i]->len - 1) words += " "; } wls[i] = new char[words.length() + 1]; strcpy(wls[i], words.c_str()); } wls[dim] = 0; return wls; } void DeleteWLStrings(char *strs[]) { int dim = 0; while (strs[dim]) { delete strs[dim]; dim++; } delete [] strs; } void ExternalLexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const { if (!fneLexer) return ; char **kwds = WordListsToStrings(keywordlists); char *ps = styler.GetProperties(); // The accessor passed in is always a DocumentAccessor so this cast and the subsequent // access will work. Can not use the stricter dynamic_cast as that requires RTTI. DocumentAccessor &da = static_cast(styler); WindowID wID = da.GetWindow(); fneLexer(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps); delete ps; DeleteWLStrings(kwds); } void ExternalLexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const { if (!fneFolder) return ; char **kwds = WordListsToStrings(keywordlists); char *ps = styler.GetProperties(); // The accessor passed in is always a DocumentAccessor so this cast and the subsequent // access will work. Can not use the stricter dynamic_cast as that requires RTTI. DocumentAccessor &da = static_cast(styler); WindowID wID = da.GetWindow(); fneFolder(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps); delete ps; DeleteWLStrings(kwds); } void ExternalLexerModule::SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index) { fneLexer = fLexer; fneFolder = fFolder; externalLanguage = index; } //------------------------------------------ // // LexerLibrary // //------------------------------------------ LexerLibrary::LexerLibrary(const char* ModuleName) { // Initialise some members... first = NULL; last = NULL; // Load the DLL lib = DynamicLibrary::Load(ModuleName); if (lib->IsValid()) { m_sModuleName = ModuleName; //Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount"); if (GetLexerCount) { ExternalLexerModule *lex; LexerMinder *lm; // Find functions in the DLL GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName"); ExtLexerFunction Lexer = (ExtLexerFunction)(sptr_t)lib->FindFunction("Lex"); ExtFoldFunction Folder = (ExtFoldFunction)(sptr_t)lib->FindFunction("Fold"); // Assign a buffer for the lexer name. char lexname[100]; strcpy(lexname, ""); int nl = GetLexerCount(); for (int i = 0; i < nl; i++) { GetLexerName(i, lexname, 100); lex = new ExternalLexerModule(SCLEX_AUTOMATIC, NULL, lexname, NULL); // Create a LexerMinder so we don't leak the ExternalLexerModule... lm = new LexerMinder; lm->self = lex; lm->next = NULL; if (first != NULL) { last->next = lm; last = lm; } else { first = lm; last = lm; } // The external lexer needs to know how to call into its DLL to // do its lexing and folding, we tell it here. Folder may be null. lex->SetExternal(Lexer, Folder, i); } } } next = NULL; } LexerLibrary::~LexerLibrary() { Release(); delete lib; } void LexerLibrary::Release() { //TODO maintain a list of lexers created, and delete them! LexerMinder *lm; LexerMinder *next; lm = first; while (NULL != lm) { next = lm->next; delete lm->self; delete lm; lm = next; } first = NULL; last = NULL; } //------------------------------------------ // // LexerManager // //------------------------------------------ /// Return the single LexerManager instance... LexerManager *LexerManager::GetInstance() { if(!theInstance) theInstance = new LexerManager; return theInstance; } /// Delete any LexerManager instance... void LexerManager::DeleteInstance() { if(theInstance) { delete theInstance; theInstance = NULL; } } /// protected constructor - this is a singleton... LexerManager::LexerManager() { first = NULL; last = NULL; } LexerManager::~LexerManager() { Clear(); } void LexerManager::Load(const char* path) { LoadLexerLibrary(path); } void LexerManager::LoadLexerLibrary(const char* module) { LexerLibrary *lib = new LexerLibrary(module); if (NULL != first) { last->next = lib; last = lib; } else { first = lib; last = lib; } } void LexerManager::Clear() { if (NULL != first) { LexerLibrary *cur = first; LexerLibrary *next; while (cur) { next = cur->next; delete cur; cur = next; } first = NULL; last = NULL; } } //------------------------------------------ // // LexerManager // //------------------------------------------ LMMinder::~LMMinder() { LexerManager::DeleteInstance(); } LMMinder minder; sqliteman-1.2.2/sqliteman/qscintilla2/src/KeyMap.cpp0000644000175000001440000001165411407213302022024 0ustar subzerousers// Scintilla source code edit control /** @file KeyMap.cxx ** Defines a mapping between keystrokes and commands. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include "Platform.h" #include "Scintilla.h" #include "KeyMap.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif KeyMap::KeyMap() : kmap(0), len(0), alloc(0) { for (int i = 0; MapDefault[i].key; i++) { AssignCmdKey(MapDefault[i].key, MapDefault[i].modifiers, MapDefault[i].msg); } } KeyMap::~KeyMap() { Clear(); } void KeyMap::Clear() { delete []kmap; kmap = 0; len = 0; alloc = 0; } void KeyMap::AssignCmdKey(int key, int modifiers, unsigned int msg) { if ((len+1) >= alloc) { KeyToCommand *ktcNew = new KeyToCommand[alloc + 5]; if (!ktcNew) return; for (int k = 0; k < len; k++) ktcNew[k] = kmap[k]; alloc += 5; delete []kmap; kmap = ktcNew; } for (int keyIndex = 0; keyIndex < len; keyIndex++) { if ((key == kmap[keyIndex].key) && (modifiers == kmap[keyIndex].modifiers)) { kmap[keyIndex].msg = msg; return; } } kmap[len].key = key; kmap[len].modifiers = modifiers; kmap[len].msg = msg; len++; } unsigned int KeyMap::Find(int key, int modifiers) { for (int i = 0; i < len; i++) { if ((key == kmap[i].key) && (modifiers == kmap[i].modifiers)) { return kmap[i].msg; } } return 0; } const KeyToCommand KeyMap::MapDefault[] = { {SCK_DOWN, SCI_NORM, SCI_LINEDOWN}, {SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND}, {SCK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN}, {SCK_DOWN, SCI_ASHIFT, SCI_LINEDOWNRECTEXTEND}, {SCK_UP, SCI_NORM, SCI_LINEUP}, {SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND}, {SCK_UP, SCI_CTRL, SCI_LINESCROLLUP}, {SCK_UP, SCI_ASHIFT, SCI_LINEUPRECTEXTEND}, {'[', SCI_CTRL, SCI_PARAUP}, {'[', SCI_CSHIFT, SCI_PARAUPEXTEND}, {']', SCI_CTRL, SCI_PARADOWN}, {']', SCI_CSHIFT, SCI_PARADOWNEXTEND}, {SCK_LEFT, SCI_NORM, SCI_CHARLEFT}, {SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND}, {SCK_LEFT, SCI_CTRL, SCI_WORDLEFT}, {SCK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND}, {SCK_LEFT, SCI_ASHIFT, SCI_CHARLEFTRECTEXTEND}, {SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT}, {SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND}, {SCK_RIGHT, SCI_CTRL, SCI_WORDRIGHT}, {SCK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND}, {SCK_RIGHT, SCI_ASHIFT, SCI_CHARRIGHTRECTEXTEND}, {'/', SCI_CTRL, SCI_WORDPARTLEFT}, {'/', SCI_CSHIFT, SCI_WORDPARTLEFTEXTEND}, {'\\', SCI_CTRL, SCI_WORDPARTRIGHT}, {'\\', SCI_CSHIFT, SCI_WORDPARTRIGHTEXTEND}, {SCK_HOME, SCI_NORM, SCI_VCHOME}, {SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND}, {SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART}, {SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, {SCK_HOME, SCI_ALT, SCI_HOMEDISPLAY}, // {SCK_HOME, SCI_ASHIFT, SCI_HOMEDISPLAYEXTEND}, {SCK_HOME, SCI_ASHIFT, SCI_VCHOMERECTEXTEND}, {SCK_END, SCI_NORM, SCI_LINEEND}, {SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND}, {SCK_END, SCI_CTRL, SCI_DOCUMENTEND}, {SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, {SCK_END, SCI_ALT, SCI_LINEENDDISPLAY}, // {SCK_END, SCI_ASHIFT, SCI_LINEENDDISPLAYEXTEND}, {SCK_END, SCI_ASHIFT, SCI_LINEENDRECTEXTEND}, {SCK_PRIOR, SCI_NORM, SCI_PAGEUP}, {SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND}, {SCK_PRIOR, SCI_ASHIFT, SCI_PAGEUPRECTEXTEND}, {SCK_NEXT, SCI_NORM, SCI_PAGEDOWN}, {SCK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND}, {SCK_NEXT, SCI_ASHIFT, SCI_PAGEDOWNRECTEXTEND}, {SCK_DELETE, SCI_NORM, SCI_CLEAR}, {SCK_DELETE, SCI_SHIFT, SCI_CUT}, {SCK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT}, {SCK_DELETE, SCI_CSHIFT, SCI_DELLINERIGHT}, {SCK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE}, {SCK_INSERT, SCI_SHIFT, SCI_PASTE}, {SCK_INSERT, SCI_CTRL, SCI_COPY}, {SCK_ESCAPE, SCI_NORM, SCI_CANCEL}, {SCK_BACK, SCI_NORM, SCI_DELETEBACK}, {SCK_BACK, SCI_SHIFT, SCI_DELETEBACK}, {SCK_BACK, SCI_CTRL, SCI_DELWORDLEFT}, {SCK_BACK, SCI_ALT, SCI_UNDO}, {SCK_BACK, SCI_CSHIFT, SCI_DELLINELEFT}, {'Z', SCI_CTRL, SCI_UNDO}, {'Y', SCI_CTRL, SCI_REDO}, {'X', SCI_CTRL, SCI_CUT}, {'C', SCI_CTRL, SCI_COPY}, {'V', SCI_CTRL, SCI_PASTE}, {'A', SCI_CTRL, SCI_SELECTALL}, {SCK_TAB, SCI_NORM, SCI_TAB}, {SCK_TAB, SCI_SHIFT, SCI_BACKTAB}, {SCK_RETURN, SCI_NORM, SCI_NEWLINE}, {SCK_RETURN, SCI_SHIFT, SCI_NEWLINE}, {SCK_ADD, SCI_CTRL, SCI_ZOOMIN}, {SCK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT}, {SCK_DIVIDE, SCI_CTRL, SCI_SETZOOM}, //'L', SCI_CTRL, SCI_FORMFEED, {'L', SCI_CTRL, SCI_LINECUT}, {'L', SCI_CSHIFT, SCI_LINEDELETE}, {'T', SCI_CSHIFT, SCI_LINECOPY}, {'T', SCI_CTRL, SCI_LINETRANSPOSE}, {'D', SCI_CTRL, SCI_SELECTIONDUPLICATE}, {'U', SCI_CTRL, SCI_LOWERCASE}, {'U', SCI_CSHIFT, SCI_UPPERCASE}, {0,0,0}, }; sqliteman-1.2.2/sqliteman/qscintilla2/src/SciTE.properties0000644000175000001440000000050111407213302023204 0ustar subzerousers# SciTE.properties is the per directory local options file and can be used to override # settings made in SciTEGlobal.properties command.build.directory.*.cxx=..\win32 command.build.directory.*.h=..\win32 command.build.*.cxx=nmake -f scintilla.mak QUIET=1 DEBUG=1 command.build.*.h=nmake -f scintilla.mak QUIET=1 DEBUG=1 sqliteman-1.2.2/sqliteman/qscintilla2/src/LexFortran.cpp0000644000175000001440000003643611407213302022727 0ustar subzerousers// Scintilla source code edit control /** @file LexFortran.cxx ** Lexer for Fortran. ** Writen by Chuan-jian Shen, Last changed Sep. 2003 **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. /***************************************/ #include #include #include #include #include /***************************************/ #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif /***********************************************/ static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%'); } /**********************************************/ static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch)); } /***************************************/ inline bool IsABlank(unsigned int ch) { return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ; } /***************************************/ inline bool IsALineEnd(char ch) { return ((ch == '\n') || (ch == '\r')) ; } /***************************************/ unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) { while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue; if (styler.SafeGetCharAt(pos) == '\n') pos++; while (IsABlank(styler.SafeGetCharAt(pos++))) continue; char chCur = styler.SafeGetCharAt(pos); if (chCur == '&') { while (IsABlank(styler.SafeGetCharAt(++pos))) continue; return pos; } else { return pos; } } /***************************************/ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler, bool isFixFormat) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; /***************************************/ int posLineStart = 0, numNonBlank = 0, prevState = 0; int endPos = startPos + length; /***************************************/ // backtrack to the nearest keyword while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) { startPos--; } startPos = styler.LineStart(styler.GetLine(startPos)); initStyle = styler.StyleAt(startPos - 1); StyleContext sc(startPos, endPos-startPos, initStyle, styler); /***************************************/ for (; sc.More(); sc.Forward()) { // remember the start position of the line if (sc.atLineStart) { posLineStart = sc.currentPos; numNonBlank = 0; sc.SetState(SCE_F_DEFAULT); } if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; /***********************************************/ // Handle the fix format generically int toLineStart = sc.currentPos - posLineStart; if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) { if (toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*') || sc.ch == '!') { sc.SetState(SCE_F_COMMENT); while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end } else if (toLineStart > 72) { sc.SetState(SCE_F_COMMENT); while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end } else if (toLineStart < 5) { if (IsADigit(sc.ch)) sc.SetState(SCE_F_LABEL); else sc.SetState(SCE_F_DEFAULT); } else if (toLineStart == 5) { if (!IsASpace(sc.ch) && sc.ch != '0') { sc.SetState(SCE_F_CONTINUATION); sc.ForwardSetState(prevState); } else sc.SetState(SCE_F_DEFAULT); } continue; } /***************************************/ // Handle line continuation generically. if (!isFixFormat && sc.ch == '&') { char chTemp = ' '; int j = 1; while (IsABlank(chTemp) && j<132) { chTemp = static_cast(sc.GetRelative(j)); j++; } if (chTemp == '!') { sc.SetState(SCE_F_CONTINUATION); if (sc.chNext == '!') sc.ForwardSetState(SCE_F_COMMENT); } else if (chTemp == '\r' || chTemp == '\n') { int currentState = sc.state; sc.SetState(SCE_F_CONTINUATION); sc.ForwardSetState(SCE_F_DEFAULT); while (IsASpace(sc.ch) && sc.More()) sc.Forward(); if (sc.ch == '&') { sc.SetState(SCE_F_CONTINUATION); sc.Forward(); } sc.SetState(currentState); } } /***************************************/ // Determine if the current state should terminate. if (sc.state == SCE_F_OPERATOR) { sc.SetState(SCE_F_DEFAULT); } else if (sc.state == SCE_F_NUMBER) { if (!(IsAWordChar(sc.ch) || sc.ch=='\'' || sc.ch=='\"' || sc.ch=='.')) { sc.SetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_IDENTIFIER) { if (!IsAWordChar(sc.ch) || (sc.ch == '%')) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_F_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_F_WORD2); } else if (keywords3.InList(s)) { sc.ChangeState(SCE_F_WORD3); } sc.SetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_COMMENT || sc.state == SCE_F_PREPROCESSOR) { if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_STRING1) { prevState = sc.state; if (sc.ch == '\'') { if (sc.chNext == '\'') { sc.Forward(); } else { sc.ForwardSetState(SCE_F_DEFAULT); prevState = SCE_F_DEFAULT; } } else if (sc.atLineEnd) { sc.ChangeState(SCE_F_STRINGEOL); sc.ForwardSetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_STRING2) { prevState = sc.state; if (sc.atLineEnd) { sc.ChangeState(SCE_F_STRINGEOL); sc.ForwardSetState(SCE_F_DEFAULT); } else if (sc.ch == '\"') { if (sc.chNext == '\"') { sc.Forward(); } else { sc.ForwardSetState(SCE_F_DEFAULT); prevState = SCE_F_DEFAULT; } } } else if (sc.state == SCE_F_OPERATOR2) { if (sc.ch == '.') { sc.ForwardSetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_CONTINUATION) { sc.SetState(SCE_F_DEFAULT); } else if (sc.state == SCE_F_LABEL) { if (!IsADigit(sc.ch)) { sc.SetState(SCE_F_DEFAULT); } else { if (isFixFormat && sc.currentPos-posLineStart > 4) sc.SetState(SCE_F_DEFAULT); else if (numNonBlank > 5) sc.SetState(SCE_F_DEFAULT); } } /***************************************/ // Determine if a new state should be entered. if (sc.state == SCE_F_DEFAULT) { if (sc.ch == '!') { if (sc.chNext == '$') { sc.SetState(SCE_F_PREPROCESSOR); } else { sc.SetState(SCE_F_COMMENT); } } else if ((!isFixFormat) && IsADigit(sc.ch) && numNonBlank == 1) { sc.SetState(SCE_F_LABEL); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_F_NUMBER); } else if ((tolower(sc.ch) == 'b' || tolower(sc.ch) == 'o' || tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) { sc.SetState(SCE_F_NUMBER); sc.Forward(); } else if (sc.ch == '.' && isalpha(sc.chNext)) { sc.SetState(SCE_F_OPERATOR2); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_F_IDENTIFIER); } else if (sc.ch == '\"') { sc.SetState(SCE_F_STRING2); } else if (sc.ch == '\'') { sc.SetState(SCE_F_STRING1); } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_F_OPERATOR); } } } sc.Complete(); } /***************************************/ // To determine the folding level depending on keywords static int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) { int lev = 0; if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) return -1; if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0 || strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0 || strcmp(s, "do") == 0 || strcmp(s, "enum") ==0 || strcmp(s, "function") == 0 || strcmp(s, "interface") == 0 || strcmp(s, "module") == 0 || strcmp(s, "program") == 0 || strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0 || (strcmp(s, "type") == 0 && chNextNonBlank != '(') ){ if (strcmp(prevWord, "end") == 0) lev = 0; else lev = 1; } else if (strcmp(s, "end") == 0 && chNextNonBlank != '=' || strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0 || strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0 || strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0 || strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0 || strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0 || strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0 || strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0 || strcmp(s, "endwhere") == 0 || strcmp(s, "procedure") == 0 ) { // Take care of the module procedure statement lev = -1; } else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if lev = 0; } return lev; } // Folding the code static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, Accessor &styler, bool isFixFormat) { // // bool foldComment = styler.GetPropertyInt("fold.comment") != 0; // Do not know how to fold the comment at the moment. // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; char chNextNonBlank; int styleNext = styler.StyleAt(startPos); int style = initStyle; /***************************************/ int lastStart = 0; char prevWord[32] = ""; char Label[6] = ""; // Variables for do label folding. static int doLabels[100]; static int posLabel=-1; /***************************************/ for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); chNextNonBlank = chNext; unsigned int j=i+1; while(IsABlank(chNextNonBlank) && j(tolower(styler[lastStart+k])); } s[k] = '\0'; // Handle the forall and where statement and structure. if (strcmp(s, "forall") == 0 || strcmp(s, "where") == 0) { if (strcmp(prevWord, "end") != 0) { j = i + 1; char chBrace = '(', chSeek = ')', ch1 = styler.SafeGetCharAt(j); // Find the position of the first ( while (ch1 != chBrace && j -1) { levelCurrent--; posLabel--; } } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; strcpy(prevWord, ""); } /***************************************/ if (!isspacechar(ch)) visibleChars++; } /***************************************/ // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } /***************************************/ static const char * const FortranWordLists[] = { "Primary keywords and identifiers", "Intrinsic functions", "Extended and user defined functions", 0, }; /***************************************/ static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false); } /***************************************/ static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true); } /***************************************/ static void FoldFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { FoldFortranDoc(startPos, length, initStyle,styler, false); } /***************************************/ static void FoldFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { FoldFortranDoc(startPos, length, initStyle,styler, true); } /***************************************/ LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDocFreeFormat, FortranWordLists); LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDocFixFormat, FortranWordLists); sqliteman-1.2.2/sqliteman/qscintilla2/src/LexVHDL.cpp0000644000175000001440000004016511407213302022043 0ustar subzerousers// Scintilla source code edit control /** @file LexVHDL.cxx ** Lexer for VHDL ** Written by Phil Reid, ** Based on: ** - The Verilog Lexer by Avi Yegudin ** - The Fortran Lexer by Chuan-jian Shen ** - The C++ lexer by Neil Hodgson **/ // Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static void ColouriseVHDLDoc( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler); /***************************************/ static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' ); } /***************************************/ static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } /***************************************/ inline bool IsABlank(unsigned int ch) { return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ; } /***************************************/ static void ColouriseVHDLDoc( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &Keywords = *keywordlists[0]; WordList &Operators = *keywordlists[1]; WordList &Attributes = *keywordlists[2]; WordList &Functions = *keywordlists[3]; WordList &Packages = *keywordlists[4]; WordList &Types = *keywordlists[5]; WordList &User = *keywordlists[6]; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // Determine if the current state should terminate. if (sc.state == SCE_VHDL_OPERATOR) { sc.SetState(SCE_VHDL_DEFAULT); } else if (sc.state == SCE_VHDL_NUMBER) { if (!IsAWordChar(sc.ch) && (sc.ch != '#')) { sc.SetState(SCE_VHDL_DEFAULT); } } else if (sc.state == SCE_VHDL_IDENTIFIER) { if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (Keywords.InList(s)) { sc.ChangeState(SCE_VHDL_KEYWORD); } else if (Operators.InList(s)) { sc.ChangeState(SCE_VHDL_STDOPERATOR); } else if (Attributes.InList(s)) { sc.ChangeState(SCE_VHDL_ATTRIBUTE); } else if (Functions.InList(s)) { sc.ChangeState(SCE_VHDL_STDFUNCTION); } else if (Packages.InList(s)) { sc.ChangeState(SCE_VHDL_STDPACKAGE); } else if (Types.InList(s)) { sc.ChangeState(SCE_VHDL_STDTYPE); } else if (User.InList(s)) { sc.ChangeState(SCE_VHDL_USERWORD); } sc.SetState(SCE_VHDL_DEFAULT); } } else if (sc.state == SCE_VHDL_COMMENT || sc.state == SCE_V_COMMENTLINEBANG) { if (sc.atLineEnd) { sc.SetState(SCE_VHDL_DEFAULT); } } else if (sc.state == SCE_VHDL_STRING) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_VHDL_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_V_STRINGEOL); sc.ForwardSetState(SCE_VHDL_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_VHDL_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_VHDL_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_VHDL_IDENTIFIER); } else if (sc.Match('-', '-')) { sc.SetState(SCE_VHDL_COMMENT); sc.Forward(); } else if (sc.Match('-', '-')) { if (sc.Match("--!")) // Nice to have a different comment style sc.SetState(SCE_VHDL_COMMENTLINEBANG); else sc.SetState(SCE_VHDL_COMMENT); } else if (sc.ch == '\"') { sc.SetState(SCE_VHDL_STRING); } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_VHDL_OPERATOR); } } } sc.Complete(); } //============================================================================= static bool IsCommentLine(int line, Accessor &styler) { int pos = styler.LineStart(line); int eol_pos = styler.LineStart(line + 1) - 1; for (int i = pos; i < eol_pos; i++) { char ch = styler[i]; char chNext = styler[i+1]; if ((ch == '-') && (chNext == '-')) return true; else if (ch != ' ' && ch != '\t') return false; } return false; } //============================================================================= // Folding the code static void FoldNoBoxVHDLDoc( unsigned int startPos, int length, int initStyle, Accessor &styler) { // Decided it would be smarter to have the lexer have all keywords included. Therefore I // don't check if the style for the keywords that I use to adjust the levels. char words[] = "architecture begin case component else elsif end entity generate loop package process record then " "procedure function when"; WordList keywords; keywords.Set(words); bool foldComment = styler.GetPropertyInt("fold.comment", 1) != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 1) != 0; bool foldAtBegin = styler.GetPropertyInt("fold.at.Begin", 1) != 0; bool foldAtParenthese = styler.GetPropertyInt("fold.at.Parenthese", 1) != 0; //bool foldAtWhen = styler.GetPropertyInt("fold.at.When", 1) != 0; //< fold at when in case statements int visibleChars = 0; unsigned int endPos = startPos + length; int lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if(lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; //int levelMinCurrent = levelCurrent; int levelMinCurrentElse = levelCurrent; //< Used for folding at 'else' int levelMinCurrentBegin = levelCurrent; //< Used for folding at 'begin' int levelNext = levelCurrent; /***************************************/ int lastStart = 0; char prevWord[32] = ""; /***************************************/ // Find prev word // The logic for going up or down a level depends on a the previous keyword // This code could be cleaned up. int end = 0; unsigned int j; for(j = startPos; j>0; j--) { char ch = styler.SafeGetCharAt(j); char chPrev = styler.SafeGetCharAt(j-1); int style = styler.StyleAt(j); int stylePrev = styler.StyleAt(j-1); if ((stylePrev != SCE_VHDL_COMMENT) && (stylePrev != SCE_VHDL_STRING)) { if(IsAWordChar(chPrev) && !IsAWordChar(ch)) { end = j-1; } } if ((style != SCE_VHDL_COMMENT) && (style != SCE_VHDL_STRING)) { if(!IsAWordChar(chPrev) && IsAWordStart(ch) && (end != 0)) { char s[32]; unsigned int k; for(k=0; (k<31 ) && (k(tolower(styler[j+k])); } s[k] = '\0'; if(keywords.InList(s)) { strcpy(prevWord, s); break; } } } } for(j=j+strlen(prevWord); j(tolower(styler[lastStart+k])); } s[k] = '\0'; if(keywords.InList(s)) { if ( strcmp(s, "architecture") == 0 || strcmp(s, "case") == 0 || strcmp(s, "component") == 0 || strcmp(s, "entity") == 0 || strcmp(s, "generate") == 0 || strcmp(s, "loop") == 0 || strcmp(s, "package") ==0 || strcmp(s, "process") == 0 || strcmp(s, "record") == 0 || strcmp(s, "then") == 0) { if (strcmp(prevWord, "end") != 0) { if (levelMinCurrentElse > levelNext) { levelMinCurrentElse = levelNext; } levelNext++; } } else if ( strcmp(s, "procedure") == 0 || strcmp(s, "function") == 0) { if (strcmp(prevWord, "end") != 0) // check for "end procedure" etc. { // This code checks to see if the procedure / function is a definition within a "package" // rather than the actual code in the body. int BracketLevel = 0; for(int j=i+1; j levelNext) { levelMinCurrentElse = levelNext; } levelNext++; break; } if((BracketLevel == 0) && (LocalCh == ';')) { break; } } } } else if (strcmp(s, "end") == 0) { levelNext--; } else if(strcmp(s, "elsif") == 0) { // elsif is followed by then so folding occurs correctly levelNext--; } else if (strcmp(s, "else") == 0) { if(strcmp(prevWord, "when") != 0) // ignore a <= x when y else z; { levelMinCurrentElse = levelNext - 1; // VHDL else is all on its own so just dec. the min level } } else if( ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "architecture") == 0)) || ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "function") == 0)) || ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "procedure") == 0))) { levelMinCurrentBegin = levelNext - 1; } //Platform::DebugPrintf("Line[%04d] Prev[%20s] Cur[%20s] Level[%x]\n", lineCurrent+1, prevWord, s, levelCurrent); strcpy(prevWord, s); } } } if (atEOL) { int levelUse = levelCurrent; if (foldAtElse && (levelMinCurrentElse < levelUse)) { levelUse = levelMinCurrentElse; } if (foldAtBegin && (levelMinCurrentBegin < levelUse)) { levelUse = levelMinCurrentBegin; } int lev = levelUse | levelNext << 16; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } //Platform::DebugPrintf("Line[%04d] ---------------------------------------------------- Level[%x]\n", lineCurrent+1, levelCurrent); lineCurrent++; levelCurrent = levelNext; //levelMinCurrent = levelCurrent; levelMinCurrentElse = levelCurrent; levelMinCurrentBegin = levelCurrent; visibleChars = 0; } /***************************************/ if (!isspacechar(ch)) visibleChars++; } /***************************************/ // Platform::DebugPrintf("Line[%04d] ---------------------------------------------------- Level[%x]\n", lineCurrent+1, levelCurrent); } //============================================================================= static void FoldVHDLDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { FoldNoBoxVHDLDoc(startPos, length, initStyle, styler); } //============================================================================= static const char * const VHDLWordLists[] = { "Keywords", "Operators", "Attributes", "Standard Functions", "Standard Packages", "Standard Types", "User Words", 0, }; LexerModule lmVHDL(SCLEX_VHDL, ColouriseVHDLDoc, "vhdl", FoldVHDLDoc, VHDLWordLists); // Keyword: // access after alias all architecture array assert attribute begin block body buffer bus case component // configuration constant disconnect downto else elsif end entity exit file for function generate generic // group guarded if impure in inertial inout is label library linkage literal loop map new next null of // on open others out package port postponed procedure process pure range record register reject report // return select severity shared signal subtype then to transport type unaffected units until use variable // wait when while with // // Operators: // abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor // // Attributes: // left right low high ascending image value pos val succ pred leftof rightof base range reverse_range // length delayed stable quiet transaction event active last_event last_active last_value driving // driving_value simple_name path_name instance_name // // Std Functions: // now readline read writeline write endfile resolved to_bit to_bitvector to_stdulogic to_stdlogicvector // to_stdulogicvector to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left shift_right rotate_left // rotate_right resize to_integer to_unsigned to_signed std_match to_01 // // Std Packages: // std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed // std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives // vital_timing // // Std Types: // boolean bit character severity_level integer real time delay_length natural positive string bit_vector // file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic // std_logic_vector X01 X01Z UX01 UX01Z unsigned signed // sqliteman-1.2.2/sqliteman/qscintilla2/src/Decoration.h0000644000175000001440000000256711407213302022375 0ustar subzerousers/** @file Decoration.h ** Visual elements added over text. **/ // Copyright 1998-2007 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef DECORATION_H #define DECORATION_H #ifdef SCI_NAMESPACE namespace Scintilla { #endif class Decoration { public: Decoration *next; RunStyles rs; int indicator; Decoration(int indicator_); ~Decoration(); bool Empty(); }; class DecorationList { int currentIndicator; int currentValue; Decoration *current; int lengthDocument; Decoration *DecorationFromIndicator(int indicator); Decoration *Create(int indicator, int length); void Delete(int indicator); void DeleteAnyEmpty(); public: Decoration *root; bool clickNotified; DecorationList(); ~DecorationList(); void SetCurrentIndicator(int indicator); int GetCurrentIndicator() { return currentIndicator; } void SetCurrentValue(int value); int GetCurrentValue() { return currentValue; } // Returns true if some values may have changed bool FillRange(int &position, int value, int &fillLength); void InsertSpace(int position, int insertLength); void DeleteRange(int position, int deleteLength); int AllOnFor(int position); int ValueAt(int indicator, int position); int Start(int indicator, int position); int End(int indicator, int position); }; #ifdef SCI_NAMESPACE } #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/LexRuby.cpp0000644000175000001440000017052711407213302022235 0ustar subzerousers// Scintilla source code edit control /** @file LexRuby.cxx ** Lexer for Ruby. **/ // Copyright 2001- by Clemens Wyss // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif //XXX Identical to Perl, put in common area static inline bool isEOLChar(char ch) { return (ch == '\r') || (ch == '\n'); } #define isSafeASCII(ch) ((unsigned int)(ch) <= 127) // This one's redundant, but makes for more readable code #define isHighBitChar(ch) ((unsigned int)(ch) > 127) static inline bool isSafeAlpha(char ch) { return (isSafeASCII(ch) && isalpha(ch)) || ch == '_'; } static inline bool isSafeAlnum(char ch) { return (isSafeASCII(ch) && isalnum(ch)) || ch == '_'; } static inline bool isSafeAlnumOrHigh(char ch) { return isHighBitChar(ch) || isalnum(ch) || ch == '_'; } static inline bool isSafeDigit(char ch) { return isSafeASCII(ch) && isdigit(ch); } static inline bool isSafeWordcharOrHigh(char ch) { // Error: scintilla's KeyWords.h includes '.' as a word-char // we want to separate things that can take methods from the // methods. return isHighBitChar(ch) || isalnum(ch) || ch == '_'; } static bool inline iswhitespace(char ch) { return ch == ' ' || ch == '\t'; } #define MAX_KEYWORD_LENGTH 200 #define STYLE_MASK 63 #define actual_style(style) (style & STYLE_MASK) static bool followsDot(unsigned int pos, Accessor &styler) { styler.Flush(); for (; pos >= 1; --pos) { int style = actual_style(styler.StyleAt(pos)); char ch; switch (style) { case SCE_RB_DEFAULT: ch = styler[pos]; if (ch == ' ' || ch == '\t') { //continue } else { return false; } break; case SCE_RB_OPERATOR: return styler[pos] == '.'; default: return false; } } return false; } // Forward declarations static bool keywordIsAmbiguous(const char *prevWord); static bool keywordDoStartsLoop(int pos, Accessor &styler); static bool keywordIsModifier(const char *word, int pos, Accessor &styler); static int ClassifyWordRb(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord) { char s[MAX_KEYWORD_LENGTH]; unsigned int i, j; unsigned int lim = end - start + 1; // num chars to copy if (lim >= MAX_KEYWORD_LENGTH) { lim = MAX_KEYWORD_LENGTH - 1; } for (i = start, j = 0; j < lim; i++, j++) { s[j] = styler[i]; } s[j] = '\0'; int chAttr; if (0 == strcmp(prevWord, "class")) chAttr = SCE_RB_CLASSNAME; else if (0 == strcmp(prevWord, "module")) chAttr = SCE_RB_MODULE_NAME; else if (0 == strcmp(prevWord, "def")) chAttr = SCE_RB_DEFNAME; else if (keywords.InList(s) && !followsDot(start - 1, styler)) { if (keywordIsAmbiguous(s) && keywordIsModifier(s, start, styler)) { // Demoted keywords are colored as keywords, // but do not affect changes in indentation. // // Consider the word 'if': // 1. <> : normal // 2. <> : demoted // 3. <> : normal: start a new indent level // 4. <> : color as identifer, since it follows '.' chAttr = SCE_RB_WORD_DEMOTED; } else { chAttr = SCE_RB_WORD; } } else chAttr = SCE_RB_IDENTIFIER; styler.ColourTo(end, chAttr); if (chAttr == SCE_RB_WORD) { strcpy(prevWord, s); } else { prevWord[0] = 0; } return chAttr; } //XXX Identical to Perl, put in common area static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) { if ((pos + static_cast(strlen(val))) >= lengthDoc) { return false; } while (*val) { if (*val != styler[pos++]) { return false; } val++; } return true; } // Do Ruby better -- find the end of the line, work back, // and then check for leading white space // Precondition: the here-doc target can be indented static bool lookingAtHereDocDelim(Accessor &styler, int pos, int lengthDoc, const char *HereDocDelim) { if (!isMatch(styler, lengthDoc, pos, HereDocDelim)) { return false; } while (--pos > 0) { char ch = styler[pos]; if (isEOLChar(ch)) { return true; } else if (ch != ' ' && ch != '\t') { return false; } } return false; } //XXX Identical to Perl, put in common area static char opposite(char ch) { if (ch == '(') return ')'; if (ch == '[') return ']'; if (ch == '{') return '}'; if (ch == '<') return '>'; return ch; } // Null transitions when we see we've reached the end // and need to relex the curr char. static void redo_char(int &i, char &ch, char &chNext, char &chNext2, int &state) { i--; chNext2 = chNext; chNext = ch; state = SCE_RB_DEFAULT; } static void advance_char(int &i, char &ch, char &chNext, char &chNext2) { i++; ch = chNext; chNext = chNext2; } // precondition: startPos points to one after the EOL char static bool currLineContainsHereDelims(int& startPos, Accessor &styler) { if (startPos <= 1) return false; int pos; for (pos = startPos - 1; pos > 0; pos--) { char ch = styler.SafeGetCharAt(pos); if (isEOLChar(ch)) { // Leave the pointers where they are -- there are no // here doc delims on the current line, even if // the EOL isn't default style return false; } else { styler.Flush(); if (actual_style(styler.StyleAt(pos)) == SCE_RB_HERE_DELIM) { break; } } } if (pos == 0) { return false; } // Update the pointers so we don't have to re-analyze the string startPos = pos; return true; } // This class is used by the enter and exit methods, so it needs // to be hoisted out of the function. class QuoteCls { public: int Count; char Up; char Down; QuoteCls() { this->New(); } void New() { Count = 0; Up = '\0'; Down = '\0'; } void Open(char u) { Count++; Up = u; Down = opposite(Up); } QuoteCls(const QuoteCls& q) { // copy constructor -- use this for copying in Count = q.Count; Up = q.Up; Down = q.Down; } QuoteCls& operator=(const QuoteCls& q) { // assignment constructor if (this != &q) { Count = q.Count; Up = q.Up; Down = q.Down; } return *this; } }; static void enterInnerExpression(int *p_inner_string_types, int *p_inner_expn_brace_counts, QuoteCls *p_inner_quotes, int& inner_string_count, int& state, int& brace_counts, QuoteCls curr_quote ) { p_inner_string_types[inner_string_count] = state; state = SCE_RB_DEFAULT; p_inner_expn_brace_counts[inner_string_count] = brace_counts; brace_counts = 0; p_inner_quotes[inner_string_count] = curr_quote; ++inner_string_count; } static void exitInnerExpression(int *p_inner_string_types, int *p_inner_expn_brace_counts, QuoteCls *p_inner_quotes, int& inner_string_count, int& state, int& brace_counts, QuoteCls& curr_quote ) { --inner_string_count; state = p_inner_string_types[inner_string_count]; brace_counts = p_inner_expn_brace_counts[inner_string_count]; curr_quote = p_inner_quotes[inner_string_count]; } static bool isEmptyLine(int pos, Accessor &styler) { int spaceFlags = 0; int lineCurrent = styler.GetLine(pos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); return (indentCurrent & SC_FOLDLEVELWHITEFLAG) != 0; } static bool RE_CanFollowKeyword(const char *keyword) { if (!strcmp(keyword, "and") || !strcmp(keyword, "begin") || !strcmp(keyword, "break") || !strcmp(keyword, "case") || !strcmp(keyword, "do") || !strcmp(keyword, "else") || !strcmp(keyword, "elsif") || !strcmp(keyword, "if") || !strcmp(keyword, "next") || !strcmp(keyword, "return") || !strcmp(keyword, "when") || !strcmp(keyword, "unless") || !strcmp(keyword, "until") || !strcmp(keyword, "not") || !strcmp(keyword, "or")) { return true; } return false; } // Look at chars up to but not including endPos // Don't look at styles in case we're looking forward static int skipWhitespace(int startPos, int endPos, Accessor &styler) { for (int i = startPos; i < endPos; i++) { if (!iswhitespace(styler[i])) { return i; } } return endPos; } // This routine looks for false positives like // undef foo, << // There aren't too many. // // iPrev points to the start of << static bool sureThisIsHeredoc(int iPrev, Accessor &styler, char *prevWord) { // Not so fast, since Ruby's so dynamic. Check the context // to make sure we're OK. int prevStyle; int lineStart = styler.GetLine(iPrev); int lineStartPosn = styler.LineStart(lineStart); styler.Flush(); // Find the first word after some whitespace int firstWordPosn = skipWhitespace(lineStartPosn, iPrev, styler); if (firstWordPosn >= iPrev) { // Have something like {^ <<} //XXX Look at the first previous non-comment non-white line // to establish the context. Not too likely though. return true; } else { switch (prevStyle = styler.StyleAt(firstWordPosn)) { case SCE_RB_WORD: case SCE_RB_WORD_DEMOTED: case SCE_RB_IDENTIFIER: break; default: return true; } } int firstWordEndPosn = firstWordPosn; char *dst = prevWord; for (;;) { if (firstWordEndPosn >= iPrev || styler.StyleAt(firstWordEndPosn) != prevStyle) { *dst = 0; break; } *dst++ = styler[firstWordEndPosn]; firstWordEndPosn += 1; } //XXX Write a style-aware thing to regex scintilla buffer objects if (!strcmp(prevWord, "undef") || !strcmp(prevWord, "def") || !strcmp(prevWord, "alias")) { // These keywords are what we were looking for return false; } return true; } // Routine that saves us from allocating a buffer for the here-doc target // targetEndPos points one past the end of the current target static bool haveTargetMatch(int currPos, int lengthDoc, int targetStartPos, int targetEndPos, Accessor &styler) { if (lengthDoc - currPos < targetEndPos - targetStartPos) { return false; } int i, j; for (i = targetStartPos, j = currPos; i < targetEndPos && j < lengthDoc; i++, j++) { if (styler[i] != styler[j]) { return false; } } return true; } // We need a check because the form // [identifier] <<[target] // is ambiguous. The Ruby lexer/parser resolves it by // looking to see if [identifier] names a variable or a // function. If it's the first, it's the start of a here-doc. // If it's a var, it's an operator. This lexer doesn't // maintain a symbol table, so it looks ahead to see what's // going on, in cases where we have // ^[white-space]*[identifier([.|::]identifier)*][white-space]*<<[target] // // If there's no occurrence of [target] on a line, assume we don't. // return true == yes, we have no heredocs static bool sureThisIsNotHeredoc(int lt2StartPos, Accessor &styler) { int prevStyle; // Use full document, not just part we're styling int lengthDoc = styler.Length(); int lineStart = styler.GetLine(lt2StartPos); int lineStartPosn = styler.LineStart(lineStart); styler.Flush(); const bool definitely_not_a_here_doc = true; const bool looks_like_a_here_doc = false; // Find the first word after some whitespace int firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler); if (firstWordPosn >= lt2StartPos) { return definitely_not_a_here_doc; } prevStyle = styler.StyleAt(firstWordPosn); // If we have '<<' following a keyword, it's not a heredoc if (prevStyle != SCE_RB_IDENTIFIER) { return definitely_not_a_here_doc; } int newStyle = prevStyle; // Some compilers incorrectly warn about uninit newStyle for (firstWordPosn += 1; firstWordPosn <= lt2StartPos; firstWordPosn += 1) { // Inner loop looks at the name for (; firstWordPosn <= lt2StartPos; firstWordPosn += 1) { newStyle = styler.StyleAt(firstWordPosn); if (newStyle != prevStyle) { break; } } // Do we have '::' or '.'? if (firstWordPosn < lt2StartPos && newStyle == SCE_RB_OPERATOR) { char ch = styler[firstWordPosn]; if (ch == '.') { // yes } else if (ch == ':') { if (styler.StyleAt(++firstWordPosn) != SCE_RB_OPERATOR) { return definitely_not_a_here_doc; } else if (styler[firstWordPosn] != ':') { return definitely_not_a_here_doc; } } else { break; } } else { break; } } // Skip next batch of white-space firstWordPosn = skipWhitespace(firstWordPosn, lt2StartPos, styler); if (firstWordPosn != lt2StartPos) { // Have [[^ws[identifier]ws[*something_else*]ws<< return definitely_not_a_here_doc; } // OK, now 'j' will point to the current spot moving ahead int j = firstWordPosn + 1; if (styler.StyleAt(j) != SCE_RB_OPERATOR || styler[j] != '<') { // This shouldn't happen return definitely_not_a_here_doc; } int nextLineStartPosn = styler.LineStart(lineStart + 1); if (nextLineStartPosn >= lengthDoc) { return definitely_not_a_here_doc; } j = skipWhitespace(j + 1, nextLineStartPosn, styler); if (j >= lengthDoc) { return definitely_not_a_here_doc; } bool allow_indent; int target_start, target_end; // From this point on no more styling, since we're looking ahead if (styler[j] == '-') { allow_indent = true; j++; } else { allow_indent = false; } // Allow for quoted targets. char target_quote = 0; switch (styler[j]) { case '\'': case '"': case '`': target_quote = styler[j]; j += 1; } if (isSafeAlnum(styler[j])) { // Init target_end because some compilers think it won't // be initialized by the time it's used target_start = target_end = j; j++; } else { return definitely_not_a_here_doc; } for (; j < lengthDoc; j++) { if (!isSafeAlnum(styler[j])) { if (target_quote && styler[j] != target_quote) { // unquoted end return definitely_not_a_here_doc; } // And for now make sure that it's a newline // don't handle arbitrary expressions yet target_end = j; if (target_quote) { // Now we can move to the character after the string delimiter. j += 1; } j = skipWhitespace(j, lengthDoc, styler); if (j >= lengthDoc) { return definitely_not_a_here_doc; } else { char ch = styler[j]; if (ch == '#' || isEOLChar(ch)) { // This is OK, so break and continue; break; } else { return definitely_not_a_here_doc; } } } } // Just look at the start of each line int last_line = styler.GetLine(lengthDoc - 1); // But don't go too far if (last_line > lineStart + 50) { last_line = lineStart + 50; } for (int line_num = lineStart + 1; line_num <= last_line; line_num++) { if (allow_indent) { j = skipWhitespace(styler.LineStart(line_num), lengthDoc, styler); } else { j = styler.LineStart(line_num); } // target_end is one past the end if (haveTargetMatch(j, lengthDoc, target_start, target_end, styler)) { // We got it return looks_like_a_here_doc; } } return definitely_not_a_here_doc; } //todo: if we aren't looking at a stdio character, // move to the start of the first line that is not in a // multi-line construct static void synchronizeDocStart(unsigned int& startPos, int &length, int &initStyle, Accessor &styler, bool skipWhiteSpace=false) { styler.Flush(); int style = actual_style(styler.StyleAt(startPos)); switch (style) { case SCE_RB_STDIN: case SCE_RB_STDOUT: case SCE_RB_STDERR: // Don't do anything else with these. return; } int pos = startPos; // Quick way to characterize each line int lineStart; for (lineStart = styler.GetLine(pos); lineStart > 0; lineStart--) { // Now look at the style before the previous line's EOL pos = styler.LineStart(lineStart) - 1; if (pos <= 10) { lineStart = 0; break; } char ch = styler.SafeGetCharAt(pos); char chPrev = styler.SafeGetCharAt(pos - 1); if (ch == '\n' && chPrev == '\r') { pos--; } if (styler.SafeGetCharAt(pos - 1) == '\\') { // Continuation line -- keep going } else if (actual_style(styler.StyleAt(pos)) != SCE_RB_DEFAULT) { // Part of multi-line construct -- keep going } else if (currLineContainsHereDelims(pos, styler)) { // Keep going, with pos and length now pointing // at the end of the here-doc delimiter } else if (skipWhiteSpace && isEmptyLine(pos, styler)) { // Keep going } else { break; } } pos = styler.LineStart(lineStart); length += (startPos - pos); startPos = pos; initStyle = SCE_RB_DEFAULT; } static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { // Lexer for Ruby often has to backtrack to start of current style to determine // which characters are being used as quotes, how deeply nested is the // start position and what the termination string is for here documents WordList &keywords = *keywordlists[0]; class HereDocCls { public: int State; // States // 0: '<<' encountered // 1: collect the delimiter // 1b: text between the end of the delimiter and the EOL // 2: here doc text (lines after the delimiter) char Quote; // the char after '<<' bool Quoted; // true if Quote in ('\'','"','`') int DelimiterLength; // strlen(Delimiter) char Delimiter[256]; // the Delimiter, limit of 256: from Perl bool CanBeIndented; HereDocCls() { State = 0; DelimiterLength = 0; Delimiter[0] = '\0'; CanBeIndented = false; } }; HereDocCls HereDoc; QuoteCls Quote; int numDots = 0; // For numbers -- // Don't start lexing in the middle of a num synchronizeDocStart(startPos, length, initStyle, styler, // ref args false); bool preferRE = true; int state = initStyle; int lengthDoc = startPos + length; char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero prevWord[0] = '\0'; if (length == 0) return; char chPrev = styler.SafeGetCharAt(startPos - 1); char chNext = styler.SafeGetCharAt(startPos); bool is_real_number = true; // Differentiate between constants and ?-sequences. // Ruby uses a different mask because bad indentation is marked by oring with 32 styler.StartAt(startPos, 127); styler.StartSegment(startPos); static int q_states[] = {SCE_RB_STRING_Q, SCE_RB_STRING_QQ, SCE_RB_STRING_QR, SCE_RB_STRING_QW, SCE_RB_STRING_QW, SCE_RB_STRING_QX}; static const char* q_chars = "qQrwWx"; // In most cases a value of 2 should be ample for the code in the // Ruby library, and the code the user is likely to enter. // For example, // fu_output_message "mkdir #{options[:mode] ? ('-m %03o ' % options[:mode]) : ''}#{list.join ' '}" // if options[:verbose] // from fileutils.rb nests to a level of 2 // If the user actually hits a 6th occurrence of '#{' in a double-quoted // string (including regex'es, %Q, %, %w, and other strings // that interpolate), it will stay as a string. The problem with this // is that quotes might flip, a 7th '#{' will look like a comment, // and code-folding might be wrong. // If anyone runs into this problem, I recommend raising this // value slightly higher to replacing the fixed array with a linked // list. Keep in mind this code will be called everytime the lexer // is invoked. #define INNER_STRINGS_MAX_COUNT 5 // These vars track our instances of "...#{,,,%Q<..#{,,,}...>,,,}..." int inner_string_types[INNER_STRINGS_MAX_COUNT]; // Track # braces when we push a new #{ thing int inner_expn_brace_counts[INNER_STRINGS_MAX_COUNT]; QuoteCls inner_quotes[INNER_STRINGS_MAX_COUNT]; int inner_string_count = 0; int brace_counts = 0; // Number of #{ ... } things within an expression int i; for (i = 0; i < INNER_STRINGS_MAX_COUNT; i++) { inner_string_types[i] = 0; inner_expn_brace_counts[i] = 0; } for (i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); char chNext2 = styler.SafeGetCharAt(i + 2); if (styler.IsLeadByte(ch)) { chNext = chNext2; chPrev = ' '; i += 1; continue; } // skip on DOS/Windows //No, don't, because some things will get tagged on, // so we won't recognize keywords, for example #if 0 if (ch == '\r' && chNext == '\n') { continue; } #endif if (HereDoc.State == 1 && isEOLChar(ch)) { // Begin of here-doc (the line after the here-doc delimiter): HereDoc.State = 2; styler.ColourTo(i-1, state); // Don't check for a missing quote, just jump into // the here-doc state state = SCE_RB_HERE_Q; } // Regular transitions if (state == SCE_RB_DEFAULT) { if (isSafeDigit(ch)) { styler.ColourTo(i - 1, state); state = SCE_RB_NUMBER; is_real_number = true; numDots = 0; } else if (isHighBitChar(ch) || iswordstart(ch)) { styler.ColourTo(i - 1, state); state = SCE_RB_WORD; } else if (ch == '#') { styler.ColourTo(i - 1, state); state = SCE_RB_COMMENTLINE; } else if (ch == '=') { // =begin indicates the start of a comment (doc) block if (i == 0 || isEOLChar(chPrev) && chNext == 'b' && styler.SafeGetCharAt(i + 2) == 'e' && styler.SafeGetCharAt(i + 3) == 'g' && styler.SafeGetCharAt(i + 4) == 'i' && styler.SafeGetCharAt(i + 5) == 'n' && !isSafeWordcharOrHigh(styler.SafeGetCharAt(i + 6))) { styler.ColourTo(i - 1, state); state = SCE_RB_POD; } else { styler.ColourTo(i - 1, state); styler.ColourTo(i, SCE_RB_OPERATOR); preferRE = true; } } else if (ch == '"') { styler.ColourTo(i - 1, state); state = SCE_RB_STRING; Quote.New(); Quote.Open(ch); } else if (ch == '\'') { styler.ColourTo(i - 1, state); state = SCE_RB_CHARACTER; Quote.New(); Quote.Open(ch); } else if (ch == '`') { styler.ColourTo(i - 1, state); state = SCE_RB_BACKTICKS; Quote.New(); Quote.Open(ch); } else if (ch == '@') { // Instance or class var styler.ColourTo(i - 1, state); if (chNext == '@') { state = SCE_RB_CLASS_VAR; advance_char(i, ch, chNext, chNext2); // pass by ref } else { state = SCE_RB_INSTANCE_VAR; } } else if (ch == '$') { // Check for a builtin global styler.ColourTo(i - 1, state); // Recognize it bit by bit state = SCE_RB_GLOBAL; } else if (ch == '/' && preferRE) { // Ambigous operator styler.ColourTo(i - 1, state); state = SCE_RB_REGEX; Quote.New(); Quote.Open(ch); } else if (ch == '<' && chNext == '<' && chNext2 != '=') { // Recognise the '<<' symbol - either a here document or a binary op styler.ColourTo(i - 1, state); i++; chNext = chNext2; styler.ColourTo(i, SCE_RB_OPERATOR); if (! (strchr("\"\'`_-", chNext2) || isSafeAlpha(chNext2))) { // It's definitely not a here-doc, // based on Ruby's lexer/parser in the // heredoc_identifier routine. // Nothing else to do. } else if (preferRE) { if (sureThisIsHeredoc(i - 1, styler, prevWord)) { state = SCE_RB_HERE_DELIM; HereDoc.State = 0; } // else leave it in default state } else { if (sureThisIsNotHeredoc(i - 1, styler)) { // leave state as default // We don't have all the heuristics Perl has for indications // of a here-doc, because '<<' is overloadable and used // for so many other classes. } else { state = SCE_RB_HERE_DELIM; HereDoc.State = 0; } } preferRE = (state != SCE_RB_HERE_DELIM); } else if (ch == ':') { styler.ColourTo(i - 1, state); if (chNext == ':') { // Mark "::" as an operator, not symbol start styler.ColourTo(i + 1, SCE_RB_OPERATOR); advance_char(i, ch, chNext, chNext2); // pass by ref state = SCE_RB_DEFAULT; preferRE = false; } else if (isSafeWordcharOrHigh(chNext)) { state = SCE_RB_SYMBOL; } else if (strchr("[*!~+-*/%=<>&^|", chNext)) { // Do the operator analysis in-line, looking ahead // Based on the table in pickaxe 2nd ed., page 339 bool doColoring = true; switch (chNext) { case '[': if (chNext2 == ']' ) { char ch_tmp = styler.SafeGetCharAt(i + 3); if (ch_tmp == '=') { i += 3; ch = ch_tmp; chNext = styler.SafeGetCharAt(i + 1); } else { i += 2; ch = chNext2; chNext = ch_tmp; } } else { doColoring = false; } break; case '*': if (chNext2 == '*') { i += 2; ch = chNext2; chNext = styler.SafeGetCharAt(i + 1); } else { advance_char(i, ch, chNext, chNext2); } break; case '!': if (chNext2 == '=' || chNext2 == '~') { i += 2; ch = chNext2; chNext = styler.SafeGetCharAt(i + 1); } else { advance_char(i, ch, chNext, chNext2); } break; case '<': if (chNext2 == '<') { i += 2; ch = chNext2; chNext = styler.SafeGetCharAt(i + 1); } else if (chNext2 == '=') { char ch_tmp = styler.SafeGetCharAt(i + 3); if (ch_tmp == '>') { // <=> operator i += 3; ch = ch_tmp; chNext = styler.SafeGetCharAt(i + 1); } else { i += 2; ch = chNext2; chNext = ch_tmp; } } else { advance_char(i, ch, chNext, chNext2); } break; default: // Simple one-character operators advance_char(i, ch, chNext, chNext2); break; } if (doColoring) { styler.ColourTo(i, SCE_RB_SYMBOL); state = SCE_RB_DEFAULT; } } else if (!preferRE) { // Don't color symbol strings (yet) // Just color the ":" and color rest as string styler.ColourTo(i, SCE_RB_SYMBOL); state = SCE_RB_DEFAULT; } else { styler.ColourTo(i, SCE_RB_OPERATOR); state = SCE_RB_DEFAULT; preferRE = true; } } else if (ch == '%') { styler.ColourTo(i - 1, state); bool have_string = false; if (strchr(q_chars, chNext) && !isSafeWordcharOrHigh(chNext2)) { Quote.New(); const char *hit = strchr(q_chars, chNext); if (hit != NULL) { state = q_states[hit - q_chars]; Quote.Open(chNext2); i += 2; ch = chNext2; chNext = styler.SafeGetCharAt(i + 1); have_string = true; } } else if (preferRE && !isSafeWordcharOrHigh(chNext)) { // Ruby doesn't allow high bit chars here, // but the editor host might state = SCE_RB_STRING_QQ; Quote.Open(chNext); advance_char(i, ch, chNext, chNext2); // pass by ref have_string = true; } if (!have_string) { styler.ColourTo(i, SCE_RB_OPERATOR); // stay in default preferRE = true; } } else if (ch == '?') { styler.ColourTo(i - 1, state); if (iswhitespace(chNext) || chNext == '\n' || chNext == '\r') { styler.ColourTo(i, SCE_RB_OPERATOR); } else { // It's the start of a character code escape sequence // Color it as a number. state = SCE_RB_NUMBER; is_real_number = false; } } else if (isoperator(ch) || ch == '.') { styler.ColourTo(i - 1, state); styler.ColourTo(i, SCE_RB_OPERATOR); // If we're ending an expression or block, // assume it ends an object, and the ambivalent // constructs are binary operators // // So if we don't have one of these chars, // we aren't ending an object exp'n, and ops // like : << / are unary operators. if (ch == '{') { ++brace_counts; preferRE = true; } else if (ch == '}' && --brace_counts < 0 && inner_string_count > 0) { styler.ColourTo(i, SCE_RB_OPERATOR); exitInnerExpression(inner_string_types, inner_expn_brace_counts, inner_quotes, inner_string_count, state, brace_counts, Quote); } else { preferRE = (strchr(")}].", ch) == NULL); } // Stay in default state } else if (isEOLChar(ch)) { // Make sure it's a true line-end, with no backslash if ((ch == '\r' || (ch == '\n' && chPrev != '\r')) && chPrev != '\\') { // Assume we've hit the end of the statement. preferRE = true; } } } else if (state == SCE_RB_WORD) { if (ch == '.' || !isSafeWordcharOrHigh(ch)) { // Words include x? in all contexts, // and = after either 'def' or a dot // Move along until a complete word is on our left // Default accessor treats '.' as word-chars, // but we don't for now. if (ch == '=' && isSafeWordcharOrHigh(chPrev) && (chNext == '(' || strchr(" \t\n\r", chNext) != NULL) && (!strcmp(prevWord, "def") || followsDot(styler.GetStartSegment(), styler))) { // = is a name only when being def'd -- Get it the next time // This means that = is always lexed as // , (op, =), } else if ((ch == '?' || ch == '!') && isSafeWordcharOrHigh(chPrev) && !isSafeWordcharOrHigh(chNext)) { // ? is a name -- Get it the next time // But ? is always lexed as // , (op, ?), // Same with ! to indicate a method that // modifies its target } else if (isEOLChar(ch) && isMatch(styler, lengthDoc, i - 7, "__END__")) { styler.ColourTo(i, SCE_RB_DATASECTION); state = SCE_RB_DATASECTION; // No need to handle this state -- we'll just move to the end preferRE = false; } else { int wordStartPos = styler.GetStartSegment(); int word_style = ClassifyWordRb(wordStartPos, i - 1, keywords, styler, prevWord); switch (word_style) { case SCE_RB_WORD: preferRE = RE_CanFollowKeyword(prevWord); break; case SCE_RB_WORD_DEMOTED: preferRE = true; break; case SCE_RB_IDENTIFIER: if (isMatch(styler, lengthDoc, wordStartPos, "print")) { preferRE = true; } else if (isEOLChar(ch)) { preferRE = true; } else { preferRE = false; } break; default: preferRE = false; } if (ch == '.') { // We might be redefining an operator-method preferRE = false; } // And if it's the first redo_char(i, ch, chNext, chNext2, state); // pass by ref } } } else if (state == SCE_RB_NUMBER) { if (!is_real_number) { if (ch != '\\') { styler.ColourTo(i, state); state = SCE_RB_DEFAULT; preferRE = false; } else if (strchr("\\ntrfvaebs", chNext)) { // Terminal escape sequence -- handle it next time // Nothing more to do this time through the loop } else if (chNext == 'C' || chNext == 'M') { if (chNext2 != '-') { // \C or \M ends the sequence -- handle it next time } else { // Move from abc?\C-x // ^ // to // ^ i += 2; ch = chNext2; chNext = styler.SafeGetCharAt(i + 1); } } else if (chNext == 'c') { // Stay here, \c is a combining sequence advance_char(i, ch, chNext, chNext2); // pass by ref } else { // ?\x, including ?\\ is final. styler.ColourTo(i + 1, state); state = SCE_RB_DEFAULT; preferRE = false; advance_char(i, ch, chNext, chNext2); } } else if (isSafeAlnumOrHigh(ch) || ch == '_') { // Keep going } else if (ch == '.' && ++numDots == 1) { // Keep going } else { styler.ColourTo(i - 1, state); redo_char(i, ch, chNext, chNext2, state); // pass by ref preferRE = false; } } else if (state == SCE_RB_COMMENTLINE) { if (isEOLChar(ch)) { styler.ColourTo(i - 1, state); state = SCE_RB_DEFAULT; // Use whatever setting we had going into the comment } } else if (state == SCE_RB_HERE_DELIM) { // See the comment for SCE_RB_HERE_DELIM in LexPerl.cxx // Slightly different: if we find an immediate '-', // the target can appear indented. if (HereDoc.State == 0) { // '<<' encountered HereDoc.State = 1; HereDoc.DelimiterLength = 0; if (ch == '-') { HereDoc.CanBeIndented = true; advance_char(i, ch, chNext, chNext2); // pass by ref } else { HereDoc.CanBeIndented = false; } if (isEOLChar(ch)) { // Bail out of doing a here doc if there's no target state = SCE_RB_DEFAULT; preferRE = false; } else { HereDoc.Quote = ch; if (ch == '\'' || ch == '"' || ch == '`') { HereDoc.Quoted = true; HereDoc.Delimiter[0] = '\0'; } else { HereDoc.Quoted = false; HereDoc.Delimiter[0] = ch; HereDoc.Delimiter[1] = '\0'; HereDoc.DelimiterLength = 1; } } } else if (HereDoc.State == 1) { // collect the delimiter if (isEOLChar(ch)) { // End the quote now, and go back for more styler.ColourTo(i - 1, state); state = SCE_RB_DEFAULT; i--; chNext = ch; chNext2 = chNext; preferRE = false; } else if (HereDoc.Quoted) { if (ch == HereDoc.Quote) { // closing quote => end of delimiter styler.ColourTo(i, state); state = SCE_RB_DEFAULT; preferRE = false; } else { if (ch == '\\' && !isEOLChar(chNext)) { advance_char(i, ch, chNext, chNext2); } HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; } } else { // an unquoted here-doc delimiter if (isSafeAlnumOrHigh(ch) || ch == '_') { HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; } else { styler.ColourTo(i - 1, state); redo_char(i, ch, chNext, chNext2, state); preferRE = false; } } if (HereDoc.DelimiterLength >= static_cast(sizeof(HereDoc.Delimiter)) - 1) { styler.ColourTo(i - 1, state); state = SCE_RB_ERROR; preferRE = false; } } } else if (state == SCE_RB_HERE_Q) { // Not needed: HereDoc.State == 2 // Indentable here docs: look backwards // Non-indentable: look forwards, like in Perl // // Why: so we can quickly resolve things like <<-" abc" if (!HereDoc.CanBeIndented) { if (isEOLChar(chPrev) && isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) { styler.ColourTo(i - 1, state); i += HereDoc.DelimiterLength - 1; chNext = styler.SafeGetCharAt(i + 1); if (isEOLChar(chNext)) { styler.ColourTo(i, SCE_RB_HERE_DELIM); state = SCE_RB_DEFAULT; HereDoc.State = 0; preferRE = false; } // Otherwise we skipped through the here doc faster. } } else if (isEOLChar(chNext) && lookingAtHereDocDelim(styler, i - HereDoc.DelimiterLength + 1, lengthDoc, HereDoc.Delimiter)) { styler.ColourTo(i - 1 - HereDoc.DelimiterLength, state); styler.ColourTo(i, SCE_RB_HERE_DELIM); state = SCE_RB_DEFAULT; preferRE = false; HereDoc.State = 0; } } else if (state == SCE_RB_CLASS_VAR || state == SCE_RB_INSTANCE_VAR || state == SCE_RB_SYMBOL) { if (!isSafeWordcharOrHigh(ch)) { styler.ColourTo(i - 1, state); redo_char(i, ch, chNext, chNext2, state); // pass by ref preferRE = false; } } else if (state == SCE_RB_GLOBAL) { if (!isSafeWordcharOrHigh(ch)) { // handle special globals here as well if (chPrev == '$') { if (ch == '-') { // Include the next char, like $-a advance_char(i, ch, chNext, chNext2); } styler.ColourTo(i, state); state = SCE_RB_DEFAULT; } else { styler.ColourTo(i - 1, state); redo_char(i, ch, chNext, chNext2, state); // pass by ref } preferRE = false; } } else if (state == SCE_RB_POD) { // PODs end with ^=end\s, -- any whitespace can follow =end if (strchr(" \t\n\r", ch) != NULL && i > 5 && isEOLChar(styler[i - 5]) && isMatch(styler, lengthDoc, i - 4, "=end")) { styler.ColourTo(i - 1, state); state = SCE_RB_DEFAULT; preferRE = false; } } else if (state == SCE_RB_REGEX || state == SCE_RB_STRING_QR) { if (ch == '\\' && Quote.Up != '\\') { // Skip one advance_char(i, ch, chNext, chNext2); } else if (ch == Quote.Down) { Quote.Count--; if (Quote.Count == 0) { // Include the options while (isSafeAlpha(chNext)) { i++; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); } styler.ColourTo(i, state); state = SCE_RB_DEFAULT; preferRE = false; } } else if (ch == Quote.Up) { // Only if close quoter != open quoter Quote.Count++; } else if (ch == '#' ) { if (chNext == '{' && inner_string_count < INNER_STRINGS_MAX_COUNT) { // process #{ ... } styler.ColourTo(i - 1, state); styler.ColourTo(i + 1, SCE_RB_OPERATOR); enterInnerExpression(inner_string_types, inner_expn_brace_counts, inner_quotes, inner_string_count, state, brace_counts, Quote); preferRE = true; // Skip one advance_char(i, ch, chNext, chNext2); } else { //todo: distinguish comments from pound chars // for now, handle as comment styler.ColourTo(i - 1, state); bool inEscape = false; while (++i < lengthDoc) { ch = styler.SafeGetCharAt(i); if (ch == '\\') { inEscape = true; } else if (isEOLChar(ch)) { // Comment inside a regex styler.ColourTo(i - 1, SCE_RB_COMMENTLINE); break; } else if (inEscape) { inEscape = false; // don't look at char } else if (ch == Quote.Down) { // Have the regular handler deal with this // to get trailing modifiers. i--; ch = styler[i]; break; } } chNext = styler.SafeGetCharAt(i + 1); chNext2 = styler.SafeGetCharAt(i + 2); } } // Quotes of all kinds... } else if (state == SCE_RB_STRING_Q || state == SCE_RB_STRING_QQ || state == SCE_RB_STRING_QX || state == SCE_RB_STRING_QW || state == SCE_RB_STRING || state == SCE_RB_CHARACTER || state == SCE_RB_BACKTICKS) { if (!Quote.Down && !isspacechar(ch)) { Quote.Open(ch); } else if (ch == '\\' && Quote.Up != '\\') { //Riddle me this: Is it safe to skip *every* escaped char? advance_char(i, ch, chNext, chNext2); } else if (ch == Quote.Down) { Quote.Count--; if (Quote.Count == 0) { styler.ColourTo(i, state); state = SCE_RB_DEFAULT; preferRE = false; } } else if (ch == Quote.Up) { Quote.Count++; } else if (ch == '#' && chNext == '{' && inner_string_count < INNER_STRINGS_MAX_COUNT && state != SCE_RB_CHARACTER && state != SCE_RB_STRING_Q) { // process #{ ... } styler.ColourTo(i - 1, state); styler.ColourTo(i + 1, SCE_RB_OPERATOR); enterInnerExpression(inner_string_types, inner_expn_brace_counts, inner_quotes, inner_string_count, state, brace_counts, Quote); preferRE = true; // Skip one advance_char(i, ch, chNext, chNext2); } } if (state == SCE_RB_ERROR) { break; } chPrev = ch; } if (state == SCE_RB_WORD) { // We've ended on a word, possibly at EOF, and need to // classify it. (void) ClassifyWordRb(styler.GetStartSegment(), lengthDoc - 1, keywords, styler, prevWord); } else { styler.ColourTo(lengthDoc - 1, state); } } // Helper functions for folding, disambiguation keywords // Assert that there are no high-bit chars static void getPrevWord(int pos, char *prevWord, Accessor &styler, int word_state) { int i; styler.Flush(); for (i = pos - 1; i > 0; i--) { if (actual_style(styler.StyleAt(i)) != word_state) { i++; break; } } if (i < pos - MAX_KEYWORD_LENGTH) // overflow i = pos - MAX_KEYWORD_LENGTH; char *dst = prevWord; for (; i <= pos; i++) { *dst++ = styler[i]; } *dst = 0; } static bool keywordIsAmbiguous(const char *prevWord) { // Order from most likely used to least likely // Lots of ways to do a loop in Ruby besides 'while/until' if (!strcmp(prevWord, "if") || !strcmp(prevWord, "do") || !strcmp(prevWord, "while") || !strcmp(prevWord, "unless") || !strcmp(prevWord, "until")) { return true; } else { return false; } } // Demote keywords in the following conditions: // if, while, unless, until modify a statement // do after a while or until, as a noise word (like then after if) static bool keywordIsModifier(const char *word, int pos, Accessor &styler) { if (word[0] == 'd' && word[1] == 'o' && !word[2]) { return keywordDoStartsLoop(pos, styler); } char ch; int style = SCE_RB_DEFAULT; int lineStart = styler.GetLine(pos); int lineStartPosn = styler.LineStart(lineStart); styler.Flush(); while (--pos >= lineStartPosn) { style = actual_style(styler.StyleAt(pos)); if (style == SCE_RB_DEFAULT) { if (iswhitespace(ch = styler[pos])) { //continue } else if (ch == '\r' || ch == '\n') { // Scintilla's LineStart() and GetLine() routines aren't // platform-independent, so if we have text prepared with // a different system we can't rely on it. return false; } } else { break; } } if (pos < lineStartPosn) { return false; //XXX not quite right if the prev line is a continuation } // First things where the action is unambiguous switch (style) { case SCE_RB_DEFAULT: case SCE_RB_COMMENTLINE: case SCE_RB_POD: case SCE_RB_CLASSNAME: case SCE_RB_DEFNAME: case SCE_RB_MODULE_NAME: return false; case SCE_RB_OPERATOR: break; case SCE_RB_WORD: // Watch out for uses of 'else if' //XXX: Make a list of other keywords where 'if' isn't a modifier // and can appear legitimately // Formulate this to avoid warnings from most compilers if (strcmp(word, "if") == 0) { char prevWord[MAX_KEYWORD_LENGTH + 1]; getPrevWord(pos, prevWord, styler, SCE_RB_WORD); return strcmp(prevWord, "else") != 0; } return true; default: return true; } // Assume that if the keyword follows an operator, // usually it's a block assignment, like // a << if x then y else z ch = styler[pos]; switch (ch) { case ')': case ']': case '}': return true; default: return false; } } #define WHILE_BACKWARDS "elihw" #define UNTIL_BACKWARDS "litnu" // Nothing fancy -- look to see if we follow a while/until somewhere // on the current line static bool keywordDoStartsLoop(int pos, Accessor &styler) { char ch; int style; int lineStart = styler.GetLine(pos); int lineStartPosn = styler.LineStart(lineStart); styler.Flush(); while (--pos >= lineStartPosn) { style = actual_style(styler.StyleAt(pos)); if (style == SCE_RB_DEFAULT) { if ((ch = styler[pos]) == '\r' || ch == '\n') { // Scintilla's LineStart() and GetLine() routines aren't // platform-independent, so if we have text prepared with // a different system we can't rely on it. return false; } } else if (style == SCE_RB_WORD) { // Check for while or until, but write the word in backwards char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero char *dst = prevWord; int wordLen = 0; int start_word; for (start_word = pos; start_word >= lineStartPosn && actual_style(styler.StyleAt(start_word)) == SCE_RB_WORD; start_word--) { if (++wordLen < MAX_KEYWORD_LENGTH) { *dst++ = styler[start_word]; } } *dst = 0; // Did we see our keyword? if (!strcmp(prevWord, WHILE_BACKWARDS) || !strcmp(prevWord, UNTIL_BACKWARDS)) { return true; } // We can move pos to the beginning of the keyword, and then // accept another decrement, as we can never have two contiguous // keywords: // word1 word2 // ^ // <- move to start_word // ^ // <- loop decrement // ^ # pointing to end of word1 is fine pos = start_word; } } return false; } /* * Folding Ruby * * The language is quite complex to analyze without a full parse. * For example, this line shouldn't affect fold level: * * print "hello" if feeling_friendly? * * Neither should this: * * print "hello" \ * if feeling_friendly? * * * But this should: * * if feeling_friendly? #++ * print "hello" \ * print "goodbye" * end #-- * * So we cheat, by actually looking at the existing indentation * levels for each line, and just echoing it back. Like Python. * Then if we get better at it, we'll take braces into consideration, * which always affect folding levels. * How the keywords should work: * No effect: * __FILE__ __LINE__ BEGIN END alias and * defined? false in nil not or self super then * true undef * Always increment: * begin class def do for module when { * * Always decrement: * end } * * Increment if these start a statement * if unless until while -- do nothing if they're modifiers * These end a block if there's no modifier, but don't bother * break next redo retry return yield * * These temporarily de-indent, but re-indent * case else elsif ensure rescue * * This means that the folder reflects indentation rather * than setting it. The language-service updates indentation * when users type return and finishes entering de-denters. * * Later offer to fold POD, here-docs, strings, and blocks of comments */ static void FoldRbDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0; synchronizeDocStart(startPos, length, initStyle, styler, // ref args false); unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = startPos == 0 ? 0 : (styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK & ~SC_FOLDLEVELBASE); int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int stylePrev = startPos <= 1 ? SCE_RB_DEFAULT : styler.StyleAt(startPos - 1); bool buffer_ends_with_eol = false; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_RB_COMMENTLINE) { if (foldComment && stylePrev != SCE_RB_COMMENTLINE) { if (chNext == '{') { levelCurrent++; } else if (chNext == '}') { levelCurrent--; } } } else if (style == SCE_RB_OPERATOR) { if (strchr("[{(", ch)) { levelCurrent++; } else if (strchr(")}]", ch)) { // Don't decrement below 0 if (levelCurrent > 0) levelCurrent--; } } else if (style == SCE_RB_WORD && styleNext != SCE_RB_WORD) { // Look at the keyword on the left and decide what to do char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero prevWord[0] = 0; getPrevWord(i, prevWord, styler, SCE_RB_WORD); if (!strcmp(prevWord, "end")) { // Don't decrement below 0 if (levelCurrent > 0) levelCurrent--; } else if ( !strcmp(prevWord, "if") || !strcmp(prevWord, "def") || !strcmp(prevWord, "class") || !strcmp(prevWord, "module") || !strcmp(prevWord, "begin") || !strcmp(prevWord, "case") || !strcmp(prevWord, "do") || !strcmp(prevWord, "while") || !strcmp(prevWord, "unless") || !strcmp(prevWord, "until") || !strcmp(prevWord, "for") ) { levelCurrent++; } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; styler.SetLevel(lineCurrent, lev|SC_FOLDLEVELBASE); lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; buffer_ends_with_eol = true; } else if (!isspacechar(ch)) { visibleChars++; buffer_ends_with_eol = false; } } // Fill in the real level of the next line, keeping the current flags as they will be filled in later if (!buffer_ends_with_eol) { lineCurrent++; int new_lev = levelCurrent; if (visibleChars == 0 && foldCompact) new_lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) new_lev |= SC_FOLDLEVELHEADERFLAG; levelCurrent = new_lev; } styler.SetLevel(lineCurrent, levelCurrent|SC_FOLDLEVELBASE); } static const char * const rubyWordListDesc[] = { "Keywords", 0 }; LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/SplitVector.h0000644000175000001440000001336111407213302022556 0ustar subzerousers// Scintilla source code edit control /** @file SplitVector.h ** Main data structure for holding arrays that handle insertions ** and deletions efficiently. **/ // Copyright 1998-2007 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef SPLITVECTOR_H #define SPLITVECTOR_H template class SplitVector { protected: T *body; int size; int lengthBody; int part1Length; int gapLength; /// invariant: gapLength == size - lengthBody int growSize; /// Move the gap to a particular position so that insertion and /// deletion at that point will not require much copying and /// hence be fast. void GapTo(int position) { if (position != part1Length) { if (position < part1Length) { memmove( body + position + gapLength, body + position, sizeof(T) * (part1Length - position)); } else { // position > part1Length memmove( body + part1Length, body + part1Length + gapLength, sizeof(T) * (position - part1Length)); } part1Length = position; } } /// Check that there is room in the buffer for an insertion, /// reallocating if more space needed. void RoomFor(int insertionLength) { if (gapLength <= insertionLength) { if (growSize * 6 < size) growSize *= 2; ReAllocate(size + insertionLength + growSize); } } void Init() { body = NULL; growSize = 8; size = 0; lengthBody = 0; part1Length = 0; gapLength = 0; } public: /// Construct a split buffer. SplitVector() { Init(); } ~SplitVector() { delete []body; body = 0; } int GetGrowSize() const { return growSize; } void SetGrowSize(int growSize_) { growSize = growSize_; } /// Reallocate the storage for the buffer to be newSize and /// copy exisiting contents to the new buffer. /// Must not be used to decrease the size of the buffer. void ReAllocate(int newSize) { if (newSize > size) { // Move the gap to the end GapTo(lengthBody); T *newBody = new T[newSize]; if ((size != 0) && (body != 0)) { memmove(newBody, body, sizeof(T) * lengthBody); delete []body; } body = newBody; gapLength += newSize - size; size = newSize; } } /// Retrieve the character at a particular position. /// Retrieving positions outside the range of the buffer returns 0. /// The assertions here are disabled since calling code can be /// simpler if out of range access works and returns 0. T ValueAt(int position) const { if (position < part1Length) { //PLATFORM_ASSERT(position >= 0); if (position < 0) { return 0; } else { return body[position]; } } else { //PLATFORM_ASSERT(position < lengthBody); if (position >= lengthBody) { return 0; } else { return body[gapLength + position]; } } } void SetValueAt(int position, T v) { if (position < part1Length) { PLATFORM_ASSERT(position >= 0); if (position < 0) { ; } else { body[position] = v; } } else { PLATFORM_ASSERT(position < lengthBody); if (position >= lengthBody) { ; } else { body[gapLength + position] = v; } } } T& operator[](int position) const { PLATFORM_ASSERT(position >= 0 && position < lengthBody); if (position < part1Length) { return body[position]; } else { return body[gapLength + position]; } } /// Retrieve the length of the buffer. int Length() const { return lengthBody; } /// Insert a single value into the buffer. /// Inserting at positions outside the current range fails. void Insert(int position, T v) { PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); if ((position < 0) || (position > lengthBody)) { return; } RoomFor(1); GapTo(position); body[part1Length] = v; lengthBody++; part1Length++; gapLength--; } /// Insert a number of elements into the buffer setting their value. /// Inserting at positions outside the current range fails. void InsertValue(int position, int insertLength, T v) { PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); if (insertLength > 0) { if ((position < 0) || (position > lengthBody)) { return; } RoomFor(insertLength); GapTo(position); for (int i = 0; i < insertLength; i++) body[part1Length + i] = v; lengthBody += insertLength; part1Length += insertLength; gapLength -= insertLength; } } /// Insert text into the buffer from an array. void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) { PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody)); if (insertLength > 0) { if ((positionToInsert < 0) || (positionToInsert > lengthBody)) { return; } RoomFor(insertLength); GapTo(positionToInsert); memmove(body + part1Length, s + positionFrom, sizeof(T) * insertLength); lengthBody += insertLength; part1Length += insertLength; gapLength -= insertLength; } } /// Delete one element from the buffer. void Delete(int position) { PLATFORM_ASSERT((position >= 0) && (position < lengthBody)); if ((position < 0) || (position >= lengthBody)) { return; } DeleteRange(position, 1); } /// Delete a range from the buffer. /// Deleting positions outside the current range fails. void DeleteRange(int position, int deleteLength) { PLATFORM_ASSERT((position >= 0) && (position + deleteLength <= lengthBody)); if ((position < 0) || ((position + deleteLength) > lengthBody)) { return; } if ((position == 0) && (deleteLength == lengthBody)) { // Full deallocation returns storage and is faster delete []body; Init(); } else if (deleteLength > 0) { GapTo(position); lengthBody -= deleteLength; gapLength += deleteLength; } } /// Delete all the buffer contents. void DeleteAll() { DeleteRange(0, lengthBody); } }; #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/CharClassify.h0000644000175000001440000000147411407213302022655 0ustar subzerousers// Scintilla source code edit control /** @file CharClassify.h ** Character classifications used by Document and RESearch. **/ // Copyright 2006 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef CHARCLASSIFY_H #define CHARCLASSIFY_H class CharClassify { public: CharClassify(); enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation }; void SetDefaultCharClasses(bool includeWordClass); void SetCharClasses(const unsigned char *chars, cc newCharClass); cc GetClass(unsigned char ch) const { return static_cast(charClass[ch]);} bool IsWord(unsigned char ch) const { return static_cast(charClass[ch]) == ccWord;} private: enum { maxChar=256 }; unsigned char charClass[maxChar]; // not type cc to save space }; #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/ContractionState.cpp0000644000175000001440000001506111407213302024116 0ustar subzerousers// Scintilla source code edit control /** @file ContractionState.cxx ** Manages visibility of lines for folding. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include "Platform.h" #include "ContractionState.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif OneLine::OneLine() { displayLine = 0; //docLine = 0; visible = true; height = 1; expanded = true; } ContractionState::ContractionState() { lines = 0; size = 0; linesInDoc = 1; linesInDisplay = 1; valid = false; docLines = 0; sizeDocLines = 0; } ContractionState::~ContractionState() { Clear(); } void ContractionState::MakeValid() const { if (!valid) { // Could be cleverer by keeping the index of the last still valid entry // rather than invalidating all. linesInDisplay = 0; for (int lineInDoc=0; lineInDoc= 0) && (lineDoc < linesInDoc)) { return lines[lineDoc].displayLine; } return -1; } int ContractionState::DocFromDisplay(int lineDisplay) const { if (lineDisplay <= 0) return 0; if (lineDisplay >= linesInDisplay) return linesInDoc; if (size == 0) return lineDisplay; MakeValid(); if (docLines) { // Valid allocation return docLines[lineDisplay]; } else { return 0; } } void ContractionState::Grow(int sizeNew) { OneLine *linesNew = new OneLine[sizeNew]; if (linesNew) { int i = 0; for (; i < size; i++) { linesNew[i] = lines[i]; } for (; i < sizeNew; i++) { linesNew[i].displayLine = i; } delete []lines; lines = linesNew; size = sizeNew; valid = false; } else { Platform::DebugPrintf("No memory available\n"); // TODO: Blow up } } void ContractionState::InsertLines(int lineDoc, int lineCount) { if (size == 0) { linesInDoc += lineCount; linesInDisplay += lineCount; return; } //Platform::DebugPrintf("InsertLine[%d] = %d\n", lineDoc); if ((linesInDoc + lineCount + 2) >= size) { Grow(linesInDoc + lineCount + growSize); } linesInDoc += lineCount; for (int i = linesInDoc; i >= lineDoc + lineCount; i--) { lines[i].visible = lines[i - lineCount].visible; lines[i].height = lines[i - lineCount].height; linesInDisplay += lines[i].height; lines[i].expanded = lines[i - lineCount].expanded; } for (int d=0;d= 0) && (lineDoc < linesInDoc)) { return lines[lineDoc].visible; } else { return false; } } bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible) { if (lineDocStart == 0) lineDocStart++; if (lineDocStart > lineDocEnd) return false; if (size == 0) { Grow(linesInDoc + growSize); } // TODO: modify docLine members to mirror displayLine int delta = 0; // Change lineDocs if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < linesInDoc)) { for (int line=lineDocStart; line <= lineDocEnd; line++) { if (lines[line].visible != visible) { delta += visible ? lines[line].height : -lines[line].height; lines[line].visible = visible; valid = false; } } } linesInDisplay += delta; return delta != 0; } bool ContractionState::GetExpanded(int lineDoc) const { if (size == 0) return true; if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { return lines[lineDoc].expanded; } else { return false; } } bool ContractionState::SetExpanded(int lineDoc, bool expanded) { if (size == 0) { if (expanded) { // If in completely expanded state then setting // one line to expanded has no effect. return false; } Grow(linesInDoc + growSize); } if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { if (lines[lineDoc].expanded != expanded) { lines[lineDoc].expanded = expanded; return true; } } return false; } int ContractionState::GetHeight(int lineDoc) const { if (size == 0) return 1; if ((lineDoc >= 0) && (lineDoc < linesInDoc)) { return lines[lineDoc].height; } else { return 1; } } // Set the number of display lines needed for this line. // Return true if this is a change. bool ContractionState::SetHeight(int lineDoc, int height) { if (lineDoc > linesInDoc) return false; if (size == 0) { if (height == 1) { // If in completely expanded state then all lines // assumed to have height of one so no effect here. return false; } Grow(linesInDoc + growSize); } if (lines[lineDoc].height != height) { lines[lineDoc].height = height; valid = false; return true; } else { return false; } } void ContractionState::ShowAll() { delete []lines; lines = 0; size = 0; delete []docLines; docLines = 0; sizeDocLines = 0; linesInDisplay = linesInDoc; } sqliteman-1.2.2/sqliteman/qscintilla2/src/PositionCache.h0000644000175000001440000000775111407213302023036 0ustar subzerousers// Scintilla source code edit control /** @file PositionCache.h ** Classes for caching layout information. **/ // Copyright 1998-2007 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef POSITIONCACHE_H #define POSITIONCACHE_H #ifdef SCI_NAMESPACE namespace Scintilla { #endif static inline bool IsEOLChar(char ch) { return (ch == '\r') || (ch == '\n'); } /** */ class LineLayout { private: friend class LineLayoutCache; int *lineStarts; int lenLineStarts; /// Drawing is only performed for @a maxLineLength characters on each line. int lineNumber; bool inCache; public: enum { wrapWidthInfinite = 0x7ffffff }; int maxLineLength; int numCharsInLine; enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity; int xHighlightGuide; bool highlightColumn; int selStart; int selEnd; bool containsCaret; int edgeColumn; char *chars; unsigned char *styles; int styleBitsSet; char *indicators; int *positions; char bracePreviousStyles[2]; // Hotspot support int hsStart; int hsEnd; // Wrapped line support int widthLine; int lines; LineLayout(int maxLineLength_); virtual ~LineLayout(); void Resize(int maxLineLength_); void Free(); void Invalidate(validLevel validity_); int LineStart(int line) const; int LineLastVisible(int line) const; void SetLineStart(int line, int start); void SetBracesHighlight(Range rangeLine, Position braces[], char bracesMatchStyle, int xHighlight); void RestoreBracesHighlight(Range rangeLine, Position braces[]); int FindBefore(int x, int lower, int upper) const; }; /** */ class LineLayoutCache { int level; int length; int size; LineLayout **cache; bool allInvalidated; int styleClock; int useCount; void Allocate(int length_); void AllocateForLevel(int linesOnScreen, int linesInDoc); public: LineLayoutCache(); virtual ~LineLayoutCache(); void Deallocate(); enum { llcNone=SC_CACHE_NONE, llcCaret=SC_CACHE_CARET, llcPage=SC_CACHE_PAGE, llcDocument=SC_CACHE_DOCUMENT }; void Invalidate(LineLayout::validLevel validity_); void SetLevel(int level_); int GetLevel() { return level; } LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, int linesOnScreen, int linesInDoc); void Dispose(LineLayout *ll); }; class PositionCacheEntry { unsigned int styleNumber:8; unsigned int len:8; unsigned int clock:16; short *positions; public: PositionCacheEntry(); ~PositionCacheEntry(); void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_, unsigned int clock); void Clear(); bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const; static int Hash(unsigned int styleNumber, const char *s, unsigned int len); bool NewerThan(const PositionCacheEntry &other); void ResetClock(); }; // Class to break a line of text into shorter runs at sensible places. class BreakFinder { // If a whole run is longer than lengthStartSubdivision then subdivide // into smaller runs at spaces or punctuation. enum { lengthStartSubdivision = 300 }; // Try to make each subdivided run lengthEachSubdivision or shorter. enum { lengthEachSubdivision = 100 }; LineLayout *ll; int lineStart; int lineEnd; int posLineStart; int nextBreak; int selAndEdge[5]; unsigned int saeLen; unsigned int saeCurrentPos; int saeNext; int subBreak; void Insert(int val); public: BreakFinder(LineLayout *ll_, int lineStart_, int lineEnd_, int posLineStart_, int xStart); int First(); int Next(); }; class PositionCache { PositionCacheEntry *pces; size_t size; unsigned int clock; bool allClear; public: PositionCache(); ~PositionCache(); void Clear(); void SetSize(size_t size_); int GetSize() { return size; } void MeasureWidths(Surface *surface, ViewStyle &vstyle, unsigned int styleNumber, const char *s, unsigned int len, int *positions); }; inline bool IsSpaceOrTab(int ch) { return ch == ' ' || ch == '\t'; } #ifdef SCI_NAMESPACE } #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/KeyMap.h0000644000175000001440000000171411407213302021465 0ustar subzerousers// Scintilla source code edit control /** @file KeyMap.h ** Defines a mapping between keystrokes and commands. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef KEYTOCOMMAND_H #define KEYTOCOMMAND_H #ifdef SCI_NAMESPACE namespace Scintilla { #endif #define SCI_NORM 0 #define SCI_SHIFT SCMOD_SHIFT #define SCI_CTRL SCMOD_CTRL #define SCI_ALT SCMOD_ALT #define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) #define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) /** */ class KeyToCommand { public: int key; int modifiers; unsigned int msg; }; /** */ class KeyMap { KeyToCommand *kmap; int len; int alloc; static const KeyToCommand MapDefault[]; public: KeyMap(); ~KeyMap(); void Clear(); void AssignCmdKey(int key, int modifiers, unsigned int msg); unsigned int Find(int key, int modifiers); // 0 returned on failure }; #ifdef SCI_NAMESPACE } #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/LexPascal.cpp0000644000175000001440000002466211407213302022515 0ustar subzerousers// Scintilla source code edit control /** @file LexPascal.cxx ** Lexer for Pascal. ** Written by Laurent le Tynevez ** Updated by Simon Steele September 2002 ** Updated by Mathias Rauen May 2003 (Delphi adjustments) **/ #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #include "StyleContext.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static void getRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) { unsigned int i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast(tolower(styler[start + i])); i++; } s[i] = '\0'; } static bool IsStreamCommentStyle(int style) { return style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC || style == SCE_C_COMMENTDOCKEYWORD || style == SCE_C_COMMENTDOCKEYWORDERROR; } static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) { if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) { styler.ColourTo(end, SCE_C_REGEX); } else styler.ColourTo(end, attr); } // returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm" static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass, bool bInAsm) { int ret = 0; WordList& keywords = *keywordlists[0]; WordList& classwords = *keywordlists[1]; char s[100]; getRange(start, end, styler, s, sizeof(s)); char chAttr = SCE_C_IDENTIFIER; if (isdigit(s[0]) || (s[0] == '.') ||(s[0] == '$')) { chAttr = SCE_C_NUMBER; } else { if (s[0] == '#') { chAttr = SCE_C_CHARACTER; } else { if (keywords.InList(s)) { chAttr = SCE_C_WORD; if(strcmp(s, "class") == 0) { ret = 1; } else if (strcmp(s, "asm") == 0) { ret = 2; } else if (strcmp(s, "end") == 0) { ret = -1; } } else if (bInClass) { if (classwords.InList(s)) { chAttr = SCE_C_WORD; } } } } ColourTo(styler, end, chAttr, (bInAsm && ret != -1)); return ret; } static int classifyFoldPointPascal(const char* s) { int lev = 0; if (!(isdigit(s[0]) || (s[0] == '.'))) { if (strcmp(s, "begin") == 0 || strcmp(s, "object") == 0 || strcmp(s, "case") == 0 || strcmp(s, "class") == 0 || strcmp(s, "record") == 0 || strcmp(s, "try") == 0) { lev=1; } else if (strcmp(s, "end") == 0) { lev=-1; } } return lev; } static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { styler.StartAt(startPos); int state = initStyle; if (state == SCE_C_CHARACTER) // Does not leak onto next line state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; unsigned int lengthDoc = startPos + length; bool bInClassDefinition; int currentLine = styler.GetLine(startPos); if (currentLine > 0) { styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); bInClassDefinition = (styler.GetLineState(currentLine) == 1); } else { styler.SetLineState(currentLine, 0); bInClassDefinition = false; } bool bInAsm = (state == SCE_C_REGEX); if (bInAsm) state = SCE_C_DEFAULT; styler.StartSegment(startPos); for (unsigned int i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix) // Avoid triggering two times on Dos/Win // End of line if (state == SCE_C_CHARACTER) { ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } currentLine++; styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0)); } if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); chPrev = ' '; i += 1; continue; } if (state == SCE_C_DEFAULT) { if (iswordstart(ch) || ch == '#' || ch == '$' || (ch == '@' && bInAsm)) { ColourTo(styler, i-1, state, bInAsm); state = SCE_C_IDENTIFIER; } else if (ch == '{' && chNext != '$' && chNext != '&') { ColourTo(styler, i-1, state, bInAsm); state = SCE_C_COMMENT; } else if (ch == '(' && chNext == '*' && styler.SafeGetCharAt(i + 2) != '$' && styler.SafeGetCharAt(i + 2) != '&') { ColourTo(styler, i-1, state, bInAsm); state = SCE_C_COMMENTDOC; } else if (ch == '/' && chNext == '/') { ColourTo(styler, i-1, state, bInAsm); state = SCE_C_COMMENTLINE; } else if (ch == '\'') { ColourTo(styler, i-1, state, bInAsm); state = SCE_C_CHARACTER; } else if (ch == '{' && (chNext == '$' || chNext=='&')) { ColourTo(styler, i-1, state, bInAsm); state = SCE_C_PREPROCESSOR; } else if (isoperator(ch)) { ColourTo(styler, i-1, state, bInAsm); ColourTo(styler, i, SCE_C_OPERATOR, bInAsm); } } else if (state == SCE_C_IDENTIFIER) { bool bDoublePoint = ((ch == '.') && (chPrev == '.')); if ((!iswordchar(ch) && ch != '$' && ch != '#' && (ch != '@' || !bInAsm)) || bDoublePoint) { if (bDoublePoint) i--; int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition, bInAsm); if(lStateChange == 1) { styler.SetLineState(currentLine, 1); bInClassDefinition = true; } else if(lStateChange == 2) { bInAsm = true; } else if(lStateChange == -1) { styler.SetLineState(currentLine, 0); bInClassDefinition = false; bInAsm = false; } if (bDoublePoint) { i++; ColourTo(styler, i-1, SCE_C_DEFAULT, bInAsm); } state = SCE_C_DEFAULT; chNext = styler.SafeGetCharAt(i + 1); if (ch == '{' && chNext != '$' && chNext != '&') { state = SCE_C_COMMENT; } else if (ch == '(' && chNext == '*' && styler.SafeGetCharAt(i + 2) != '$' && styler.SafeGetCharAt(i + 2) != '&') { ColourTo(styler, i-1, state, bInAsm); state = SCE_C_COMMENTDOC; } else if (ch == '/' && chNext == '/') { state = SCE_C_COMMENTLINE; } else if (ch == '\'') { state = SCE_C_CHARACTER; } else if (isoperator(ch)) { ColourTo(styler, i, SCE_C_OPERATOR, bInAsm); } } } else { if (state == SCE_C_PREPROCESSOR) { if (ch=='}'){ ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } else { if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) { ColourTo(styler, i-1, state, bInAsm); state = SCE_C_DEFAULT; } } } else if (state == SCE_C_COMMENT) { if (ch == '}' ) { ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } } else if (state == SCE_C_COMMENTDOC) { if (ch == ')' && chPrev == '*') { if (((i > styler.GetStartSegment() + 2) || ( (initStyle == SCE_C_COMMENTDOC) && (styler.GetStartSegment() == static_cast(startPos))))) { ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } } } else if (state == SCE_C_COMMENTLINE) { if (ch == '\r' || ch == '\n') { ColourTo(styler, i-1, state, bInAsm); state = SCE_C_DEFAULT; } } else if (state == SCE_C_CHARACTER) { if (ch == '\'') { ColourTo(styler, i, state, bInAsm); state = SCE_C_DEFAULT; } } } chPrev = ch; } ColourTo(styler, lengthDoc - 1, state, bInAsm); } static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; int lastStart = 0; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (stylePrev != SCE_C_WORD && style == SCE_C_WORD) { // Store last word start point. lastStart = i; } if (stylePrev == SCE_C_WORD) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[100]; getRange(lastStart, i, styler, s, sizeof(s)); levelCurrent += classifyFoldPointPascal(s); } } if (foldComment && (style == SCE_C_COMMENTLINE)) { if ((ch == '/') && (chNext == '/')) { char chNext2 = styler.SafeGetCharAt(i + 2); if (chNext2 == '{') { levelCurrent++; } else if (chNext2 == '}') { levelCurrent--; } } } if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '{' && chNext == '$') { unsigned int j=i+2; // skip {$ while ((j levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const pascalWordListDesc[] = { "Keywords", "Classwords", 0 }; LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc, pascalWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/LexLua.cpp0000644000175000001440000002525411407213302022031 0ustar subzerousers// Scintilla source code edit control /** @file LexLua.cxx ** Lexer for Lua language. ** ** Written by Paul Winwood. ** Folder by Alexey Yutkin. ** Modified by Marcos E. Wurzius & Philippe Lhoste **/ #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif // Extended to accept accented characters static inline bool IsAWordChar(int ch) { return ch >= 0x80 || (isalnum(ch) || ch == '.' || ch == '_'); } static inline bool IsAWordStart(int ch) { return ch >= 0x80 || (isalpha(ch) || ch == '_'); } static inline bool IsANumberChar(int ch) { // Not exactly following number definition (several dots are seen as OK, etc.) // but probably enough in most cases. return (ch < 0x80) && (isdigit(ch) || toupper(ch) == 'E' || ch == '.' || ch == '-' || ch == '+' || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F')); } static inline bool IsLuaOperator(int ch) { if (ch >= 0x80 || isalnum(ch)) { return false; } // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '{' || ch == '}' || ch == '~' || ch == '[' || ch == ']' || ch == ';' || ch == '<' || ch == '>' || ch == ',' || ch == '.' || ch == '^' || ch == '%' || ch == ':' || ch == '#') { return true; } return false; } // Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ], // return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on. // The maximum number of '=' characters allowed is 254. static int LongDelimCheck(StyleContext &sc) { int sep = 1; while (sc.GetRelative(sep) == '=' && sep < 0xFF) sep++; if (sc.GetRelative(sep) == sc.ch) return sep; return 0; } static void ColouriseLuaDoc( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; WordList &keywords5 = *keywordlists[4]; WordList &keywords6 = *keywordlists[5]; WordList &keywords7 = *keywordlists[6]; WordList &keywords8 = *keywordlists[7]; int currentLine = styler.GetLine(startPos); // Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level, // if we are inside such a string. Block comment was introduced in Lua 5.0, // blocks with separators [=[ ... ]=] in Lua 5.1. int nestLevel = 0; int sepCount = 0; if (initStyle == SCE_LUA_LITERALSTRING || initStyle == SCE_LUA_COMMENT) { int lineState = styler.GetLineState(currentLine - 1); nestLevel = lineState >> 8; sepCount = lineState & 0xFF; } // Do not leak onto next line if (initStyle == SCE_LUA_STRINGEOL || initStyle == SCE_LUA_COMMENTLINE || initStyle == SCE_LUA_PREPROCESSOR) { initStyle = SCE_LUA_DEFAULT; } StyleContext sc(startPos, length, initStyle, styler); if (startPos == 0 && sc.ch == '#') { // shbang line: # is a comment only if first char of the script sc.SetState(SCE_LUA_COMMENTLINE); } for (; sc.More(); sc.Forward()) { if (sc.atLineEnd) { // Update the line state, so it can be seen by next line currentLine = styler.GetLine(sc.currentPos); switch (sc.state) { case SCE_LUA_LITERALSTRING: case SCE_LUA_COMMENT: // Inside a literal string or block comment, we set the line state styler.SetLineState(currentLine, (nestLevel << 8) | sepCount); break; default: // Reset the line state styler.SetLineState(currentLine, 0); break; } } if (sc.atLineStart && (sc.state == SCE_LUA_STRING)) { // Prevent SCE_LUA_STRINGEOL from leaking back to previous line sc.SetState(SCE_LUA_STRING); } // Handle string line continuation if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) && sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate. if (sc.state == SCE_LUA_OPERATOR) { sc.SetState(SCE_LUA_DEFAULT); } else if (sc.state == SCE_LUA_NUMBER) { // We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char if (!IsANumberChar(sc.ch)) { sc.SetState(SCE_LUA_DEFAULT); } else if (sc.ch == '-' || sc.ch == '+') { if (sc.chPrev != 'E' && sc.chPrev != 'e') sc.SetState(SCE_LUA_DEFAULT); } } else if (sc.state == SCE_LUA_IDENTIFIER) { if (!IsAWordChar(sc.ch) || sc.Match('.', '.')) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_LUA_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_LUA_WORD2); } else if (keywords3.InList(s)) { sc.ChangeState(SCE_LUA_WORD3); } else if (keywords4.InList(s)) { sc.ChangeState(SCE_LUA_WORD4); } else if (keywords5.InList(s)) { sc.ChangeState(SCE_LUA_WORD5); } else if (keywords6.InList(s)) { sc.ChangeState(SCE_LUA_WORD6); } else if (keywords7.InList(s)) { sc.ChangeState(SCE_LUA_WORD7); } else if (keywords8.InList(s)) { sc.ChangeState(SCE_LUA_WORD8); } sc.SetState(SCE_LUA_DEFAULT); } } else if (sc.state == SCE_LUA_COMMENTLINE || sc.state == SCE_LUA_PREPROCESSOR) { if (sc.atLineEnd) { sc.ForwardSetState(SCE_LUA_DEFAULT); } } else if (sc.state == SCE_LUA_STRING) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_LUA_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_LUA_STRINGEOL); sc.ForwardSetState(SCE_LUA_DEFAULT); } } else if (sc.state == SCE_LUA_CHARACTER) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_LUA_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_LUA_STRINGEOL); sc.ForwardSetState(SCE_LUA_DEFAULT); } } else if (sc.state == SCE_LUA_LITERALSTRING || sc.state == SCE_LUA_COMMENT) { if (sc.ch == '[') { int sep = LongDelimCheck(sc); if (sep == 1 && sepCount == 1) { // [[-only allowed to nest nestLevel++; sc.Forward(); } } else if (sc.ch == ']') { int sep = LongDelimCheck(sc); if (sep == 1 && sepCount == 1) { // un-nest with ]]-only nestLevel--; sc.Forward(); if (nestLevel == 0) { sc.ForwardSetState(SCE_LUA_DEFAULT); } } else if (sep > 1 && sep == sepCount) { // ]=]-style delim sc.Forward(sep); sc.ForwardSetState(SCE_LUA_DEFAULT); } } } // Determine if a new state should be entered. if (sc.state == SCE_LUA_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_LUA_NUMBER); if (sc.ch == '0' && toupper(sc.chNext) == 'X') { sc.Forward(1); } } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_LUA_IDENTIFIER); } else if (sc.ch == '\"') { sc.SetState(SCE_LUA_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_LUA_CHARACTER); } else if (sc.ch == '[') { sepCount = LongDelimCheck(sc); if (sepCount == 0) { sc.SetState(SCE_LUA_OPERATOR); } else { nestLevel = 1; sc.SetState(SCE_LUA_LITERALSTRING); sc.Forward(sepCount); } } else if (sc.Match('-', '-')) { sc.SetState(SCE_LUA_COMMENTLINE); if (sc.Match("--[")) { sc.Forward(2); sepCount = LongDelimCheck(sc); if (sepCount > 0) { nestLevel = 1; sc.ChangeState(SCE_LUA_COMMENT); sc.Forward(sepCount); } } else { sc.Forward(); } } else if (sc.atLineStart && sc.Match('$')) { sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code } else if (IsLuaOperator(static_cast(sc.ch))) { sc.SetState(SCE_LUA_OPERATOR); } } } sc.Complete(); } static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[], Accessor &styler) { unsigned int lengthDoc = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; int styleNext = styler.StyleAt(startPos); char s[10]; for (unsigned int i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_LUA_WORD) { if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') { for (unsigned int j = 0; j < 8; j++) { if (!iswordchar(styler[i + j])) { break; } s[j] = styler[i + j]; s[j + 1] = '\0'; } if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0) || (strcmp(s, "repeat") == 0)) { levelCurrent++; } if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0) || (strcmp(s, "until") == 0)) { levelCurrent--; } } } else if (style == SCE_LUA_OPERATOR) { if (ch == '{' || ch == '(') { levelCurrent++; } else if (ch == '}' || ch == ')') { levelCurrent--; } } else if (style == SCE_LUA_LITERALSTRING || style == SCE_LUA_COMMENT) { if (ch == '[') { levelCurrent++; } else if (ch == ']') { levelCurrent--; } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) { lev |= SC_FOLDLEVELWHITEFLAG; } if ((levelCurrent > levelPrev) && (visibleChars > 0)) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) { visibleChars++; } } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const luaWordListDesc[] = { "Keywords", "Basic functions", "String, (table) & math functions", "(coroutines), I/O & system facilities", "user1", "user2", "user3", "user4", 0 }; LexerModule lmLua(SCLEX_LUA, ColouriseLuaDoc, "lua", FoldLuaDoc, luaWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/LexTCL.cpp0000644000175000001440000003120211407213302021720 0ustar subzerousers// Scintilla source code edit control /** @file LexTCL.cxx ** Lexer for TCL language. **/ // Copyright 1998-2001 by Andre Arpin // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif // Extended to accept accented characters static inline bool IsAWordChar(int ch) { return ch >= 0x80 || (isalnum(ch) || ch == '_' || ch ==':' || ch=='.'); // : name space separator } static inline bool IsAWordStart(int ch) { return ch >= 0x80 || (ch ==':' || isalpha(ch) || ch == '_'); } static inline bool IsANumberChar(int ch) { // Not exactly following number definition (several dots are seen as OK, etc.) // but probably enough in most cases. return (ch < 0x80) && (IsADigit(ch, 0x10) || toupper(ch) == 'E' || ch == '.' || ch == '-' || ch == '+'); } static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *keywordlists[], Accessor &styler) { #define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT) bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool commentLevel = false; bool subBrace = false; // substitution begin with a brace ${.....} enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf, LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32 } lineState = LS_DEFAULT; bool prevSlash = false; int currentLevel = 0; bool expected = 0; bool subParen = 0; int currentLine = styler.GetLine(startPos); if (currentLine > 0) currentLine--; length += startPos - styler.LineStart(currentLine); // make sure lines overlap startPos = styler.LineStart(currentLine); WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; WordList &keywords5 = *keywordlists[4]; WordList &keywords6 = *keywordlists[5]; WordList &keywords7 = *keywordlists[6]; WordList &keywords8 = *keywordlists[7]; WordList &keywords9 = *keywordlists[8]; if (currentLine > 0) { int ls = styler.GetLineState(currentLine - 1); lineState = tLineState(ls & LS_MASK_STATE); expected = LS_COMMAND_EXPECTED == tLineState(ls & LS_COMMAND_EXPECTED); subBrace = LS_BRACE_ONLY == tLineState(ls & LS_BRACE_ONLY); currentLevel = styler.LevelAt(currentLine - 1) >> 17; commentLevel = (styler.LevelAt(currentLine - 1) >> 16) & 1; } else styler.SetLevel(0, SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG); bool visibleChars = false; int previousLevel = currentLevel; StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler); for (; ; sc.Forward()) { next: if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac continue; bool atEnd = !sc.More(); // make sure we coloured the last word if (lineState != LS_DEFAULT) { sc.SetState(SCE_TCL_DEFAULT); if (lineState == LS_OPEN_COMMENT) sc.SetState(SCE_TCL_COMMENTLINE); else if (lineState == LS_OPEN_DOUBLE_QUOTE) sc.SetState(SCE_TCL_IN_QUOTE); else if (lineState == LS_COMMENT_BOX && (sc.ch == '#' || (sc.ch == ' ' && sc.chNext=='#'))) sc.SetState(SCE_TCL_COMMENT_BOX); lineState = LS_DEFAULT; } if (subBrace) { // ${ overrides every thing even \ except } if (sc.ch == '}') { subBrace = false; sc.SetState(SCE_TCL_OPERATOR); sc.ForwardSetState(SCE_TCL_DEFAULT); goto next; } else sc.SetState(SCE_TCL_SUB_BRACE); if (!sc.atLineEnd) continue; } else if (sc.state == SCE_TCL_DEFAULT || sc.state ==SCE_TCL_OPERATOR) { expected &= isspacechar(static_cast(sc.ch)) || IsAWordStart(sc.ch) || sc.ch =='#'; } else if (sc.state == SCE_TCL_SUBSTITUTION) { switch(sc.ch) { case '(': subParen=true; sc.SetState(SCE_TCL_OPERATOR); sc.ForwardSetState(SCE_TCL_SUBSTITUTION); continue; case ')': sc.SetState(SCE_TCL_OPERATOR); subParen=false; continue; case '$': continue; case ',': sc.SetState(SCE_TCL_OPERATOR); if (subParen) sc.ForwardSetState(SCE_TCL_SUBSTITUTION); continue; default : // maybe spaces should be allowed ??? if (!IsAWordChar(sc.ch)) { // probably the code is wrong sc.SetState(SCE_TCL_DEFAULT); subParen = 0; } break; } } else if (isComment(sc.state)) { } else if (!IsAWordChar(sc.ch)) { if ((sc.state == SCE_TCL_IDENTIFIER && expected) || sc.state == SCE_TCL_MODIFIER) { char w[100]; char *s=w; sc.GetCurrent(w, sizeof(w)); if (w[strlen(w)-1]=='\r') w[strlen(w)-1]=0; while(*s == ':') // ignore leading : like in ::set a 10 ++s; bool quote = sc.state == SCE_TCL_IN_QUOTE; if (commentLevel || expected) { if (keywords.InList(s)) { sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD2); } else if (keywords3.InList(s)) { sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD3); } else if (keywords4.InList(s)) { sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD4); } else if (sc.GetRelative(-static_cast(strlen(s))-1) == '{' && keywords5.InList(s) && sc.ch == '}') { // {keyword} exactly no spaces sc.ChangeState(SCE_TCL_EXPAND); } if (keywords6.InList(s)) { sc.ChangeState(SCE_TCL_WORD5); } else if (keywords7.InList(s)) { sc.ChangeState(SCE_TCL_WORD6); } else if (keywords8.InList(s)) { sc.ChangeState(SCE_TCL_WORD7); } else if (keywords9.InList(s)) { sc.ChangeState(SCE_TCL_WORD8); } } expected = false; sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT); } else if (sc.state == SCE_TCL_MODIFIER || sc.state == SCE_TCL_IDENTIFIER) { sc.SetState(SCE_TCL_DEFAULT); } } if (atEnd) break; if (sc.atLineEnd) { lineState = LS_DEFAULT; currentLine = styler.GetLine(sc.currentPos); if (foldComment && sc.state!=SCE_TCL_COMMENT && isComment(sc.state)) { if (currentLevel == 0) { ++currentLevel; commentLevel = true; } } else { if (visibleChars && commentLevel) { --currentLevel; --previousLevel; commentLevel = false; } } int flag = 0; if (!visibleChars) flag = SC_FOLDLEVELWHITEFLAG; if (currentLevel > previousLevel) flag = SC_FOLDLEVELHEADERFLAG; styler.SetLevel(currentLine, flag + previousLevel + SC_FOLDLEVELBASE + (currentLevel << 17) + (commentLevel << 16)); // Update the line state, so it can be seen by next line if (sc.state == SCE_TCL_IN_QUOTE) lineState = LS_OPEN_DOUBLE_QUOTE; else { if (prevSlash) { if (isComment(sc.state)) lineState = LS_OPEN_COMMENT; } else if (sc.state == SCE_TCL_COMMENT_BOX) lineState = LS_COMMENT_BOX; } styler.SetLineState(currentLine, (subBrace ? LS_BRACE_ONLY : 0) | (expected ? LS_COMMAND_EXPECTED : 0) | lineState); if (lineState == LS_COMMENT_BOX) sc.ForwardSetState(SCE_TCL_COMMENT_BOX); else if (lineState == LS_OPEN_DOUBLE_QUOTE) sc.ForwardSetState(SCE_TCL_IN_QUOTE); else sc.ForwardSetState(SCE_TCL_DEFAULT); prevSlash = false; previousLevel = currentLevel; goto next; } if (prevSlash) { prevSlash = false; if (sc.ch == '#' && IsANumberChar(sc.chNext)) sc.ForwardSetState(SCE_TCL_NUMBER); continue; } prevSlash = sc.ch == '\\'; if (isComment(sc.state)) continue; if (sc.atLineStart) { visibleChars = false; if (sc.state!=SCE_TCL_IN_QUOTE && !isComment(sc.state)) { sc.SetState(SCE_TCL_DEFAULT); expected = IsAWordStart(sc.ch)|| isspacechar(static_cast(sc.ch)); } } switch (sc.state) { case SCE_TCL_NUMBER: if (!IsANumberChar(sc.ch)) sc.SetState(SCE_TCL_DEFAULT); break; case SCE_TCL_IN_QUOTE: if (sc.ch == '"') { sc.ForwardSetState(SCE_TCL_DEFAULT); visibleChars = true; // necessary if a " is the first and only character on a line goto next; } else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$') { sc.SetState(SCE_TCL_OPERATOR); expected = sc.ch == '['; sc.ForwardSetState(SCE_TCL_IN_QUOTE); goto next; } continue; case SCE_TCL_OPERATOR: sc.SetState(SCE_TCL_DEFAULT); break; } if (sc.ch == '#') { if (visibleChars) { if (sc.state != SCE_TCL_IN_QUOTE && expected) sc.SetState(SCE_TCL_COMMENT); } else { sc.SetState(SCE_TCL_COMMENTLINE); if (sc.chNext == '~') sc.SetState(SCE_TCL_BLOCK_COMMENT); if (sc.atLineStart && (sc.chNext == '#' || sc.chNext == '-')) sc.SetState(SCE_TCL_COMMENT_BOX); } } if (!isspacechar(static_cast(sc.ch))) { visibleChars = true; } if (sc.ch == '\\') { prevSlash = true; continue; } // Determine if a new state should be entered. if (sc.state == SCE_TCL_DEFAULT) { if (IsAWordStart(sc.ch)) { sc.SetState(SCE_TCL_IDENTIFIER); } else if (IsADigit(sc.ch) && !IsAWordChar(sc.chPrev)) { sc.SetState(SCE_TCL_NUMBER); } else { switch (sc.ch) { case '\"': sc.SetState(SCE_TCL_IN_QUOTE); break; case '{': sc.SetState(SCE_TCL_OPERATOR); expected = true; ++currentLevel; break; case '}': sc.SetState(SCE_TCL_OPERATOR); --currentLevel; break; case '[': expected = true; case ']': case '(': case ')': sc.SetState(SCE_TCL_OPERATOR); break; case ';': expected = true; break; case '$': subParen = 0; if (sc.chNext != '{') { sc.SetState(SCE_TCL_SUBSTITUTION); } else { sc.SetState(SCE_TCL_OPERATOR); // $ sc.Forward(); // { sc.ForwardSetState(SCE_TCL_SUB_BRACE); subBrace = true; } break; case '#': if ((isspacechar(static_cast(sc.chPrev))|| isoperator(static_cast(sc.chPrev))) && IsADigit(sc.chNext,0x10)) sc.SetState(SCE_TCL_NUMBER); break; case '-': sc.SetState(IsADigit(sc.chNext)? SCE_TCL_NUMBER: SCE_TCL_MODIFIER); break; default: if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_TCL_OPERATOR); } } } } } sc.Complete(); } static const char * const tclWordListDesc[] = { "TCL Keywords", "TK Keywords", "iTCL Keywords", "tkCommands", "expand" "user1", "user2", "user3", "user4", 0 }; // this code supports folding in the colourizer LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/LexProgress.cpp0000644000175000001440000002061411407213302023107 0ustar subzerousers// Scintilla source code edit control /** @file LexProgress.cxx ** Lexer for Progress 4GL. ** Based on LexCPP.cxx of Neil Hodgson **/ // Copyright 2006-2007 by Yuval Papish // The License.txt file describes the conditions under which this software may be distributed. /** TODO: WebSpeed support in html lexer Support "end triggers" expression of the triggers phrase change lmPS to lmProgress Support more than 6 comments levels **/ #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static inline bool IsAWordChar(int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static inline bool IsAWordStart(int ch) { return (ch < 0x80) && (isalpha(ch) || ch == '_'); } enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit = 0 static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords1 = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; //WordList &keywords4 = *keywordlists[3]; //WordList &keywords5 = *keywordlists[4]; int visibleChars = 0; int mask; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { // Reset states to begining of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; } // Handle line continuation generically. if (sc.ch == '~') { // Skip whitespace between ~ and EOL /* do { sc.Forward(); } */ while ((sc.chNext == ' ' || sc.chNext == '\t') ) { sc.Forward(); sc.More(); } if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } sc.Forward(); continue; } } // Determine if a new state should be terminated. mask = sc.state & 0x10; switch (sc.state & 0xf) { case SCE_4GL_OPERATOR: sc.SetState(SCE_4GL_DEFAULT | mask); break; case SCE_4GL_NUMBER: if (!(IsADigit(sc.ch))) { sc.SetState(SCE_4GL_DEFAULT | mask); } break; case SCE_4GL_IDENTIFIER: if (!IsAWordChar(sc.ch) && sc.ch != '-') { char s[1000]; sc.GetCurrentLowered(s, sizeof(s)); if (((sc.state & 0x10) == 0) && keywords2.InList(s) || keywords3.InList(s)) { sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart); } else if (keywords1.InList(s)) { if ((s[0] == 'e' && s[1] =='n' && s[2] == 'd' && !isalnum(s[3]) && s[3] != '-') || (s[0] == 'f' && s[1] =='o' && s[2] == 'r' && s[3] == 'w' && s[4] =='a' && s[5] == 'r' && s[6] == 'd'&& !isalnum(s[7]))) { sc.ChangeState(SCE_4GL_END | ResetSentenceStart); } else if ((s[0] == 'e' && s[1] =='l' && s[2] == 's' && s[3] == 'e') || (s[0] == 't' && s[1] =='h' && s[2] == 'e' && s[3] == 'n')) { sc.ChangeState(SCE_4GL_WORD & SetSentenceStart); } else { sc.ChangeState(SCE_4GL_WORD | ResetSentenceStart); } } sc.SetState(SCE_4GL_DEFAULT | (sc.state & 0x10)); } break; case SCE_4GL_PREPROCESSOR: if (sc.atLineStart) { sc.SetState(SCE_4GL_DEFAULT & SetSentenceStart); } else if (sc.ch == '*' && sc.chNext == '/') { sc.ForwardSetState(SCE_4GL_DEFAULT | mask); } break; case SCE_4GL_STRING: if (sc.ch == '\"') { sc.ForwardSetState(SCE_4GL_DEFAULT | mask); } break; case SCE_4GL_CHARACTER: if (sc.ch == '\'') { sc.ForwardSetState(SCE_4GL_DEFAULT | mask); } break; default: if ((sc.state & 0xf) >= SCE_4GL_COMMENT1) { if (sc.ch == '*' && sc.chNext == '/') { sc.Forward(); if ((sc.state & 0xf) == SCE_4GL_COMMENT1) { sc.ForwardSetState(SCE_4GL_DEFAULT | mask); } else sc.SetState((sc.state & 0x1f) - 1); } else if (sc.ch == '/' && sc.chNext == '*') { sc.Forward(); sc.SetState((sc.state & 0x1f) + 1); } } } // Determine if a new state should be entered. mask = sc.state & 0x10; if ((sc.state & 0xf) == SCE_4GL_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_4GL_NUMBER | ResetSentenceStart); } else if (IsAWordStart(sc.ch) || (sc.ch == '@')) { sc.SetState(SCE_4GL_IDENTIFIER | mask); } else if (sc.ch == '/' && sc.chNext == '*') { sc.SetState(SCE_4GL_COMMENT1 | mask); sc.Forward(); } else if (sc.ch == '\"') { sc.SetState(SCE_4GL_STRING | ResetSentenceStart); } else if (sc.ch == '\'') { sc.SetState(SCE_4GL_CHARACTER | ResetSentenceStart); } else if (sc.ch == '&' && visibleChars == 0 && ((sc.state & 0x10) == 0)) { sc.SetState(SCE_4GL_PREPROCESSOR | ResetSentenceStart); // Skip whitespace between & and preprocessor word do { sc.Forward(); } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); // Handle syntactical line termination } else if ((sc.ch == '.' || sc.ch == ':' || sc.ch == '}') && (sc.chNext == ' ' || sc.chNext == '\t' || sc.chNext == '\n' || sc.chNext == '\r')) { sc.SetState(sc.state & SetSentenceStart); } else if (isoperator(static_cast(sc.ch))) { if (sc.ch == ':') sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart); else sc.SetState(SCE_4GL_OPERATOR | ResetSentenceStart); } } if (!IsASpace(sc.ch)) { visibleChars++; } } sc.Complete(); } static bool IsStreamCommentStyle(int style) { return (style & 0xf) >= SCE_4GL_COMMENT1 ; } // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". static void FoldNoBox4glDoc(unsigned int startPos, int length, int initStyle, Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = static_cast(tolower(styler[startPos])); int styleNext = styler.StyleAt(startPos); int style = initStyle; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = static_cast(tolower(styler.SafeGetCharAt(i + 1))); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev)) { levelNext++; } else if (!IsStreamCommentStyle(styleNext)) { // && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } } else if ((style & 0xf) == SCE_4GL_BLOCK && !isalnum(chNext)) { levelNext++; } else if ((style & 0xf) == SCE_4GL_END && (ch == 'e' || ch == 'f')) { levelNext--; } if (atEOL) { int levelUse = levelCurrent; if (foldAtElse) { levelUse = levelMinCurrent; } int lev = levelUse | levelNext << 16; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelCurrent = levelNext; levelMinCurrent = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } } static void Fold4glDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { FoldNoBox4glDoc(startPos, length, initStyle, styler); } static const char * const FglWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", "Documentation comment keywords", "Unused", "Global classes and typedefs", 0, }; LexerModule lmProgress(SCLEX_PS, Colourise4glDoc, "progress", Fold4glDoc, FglWordLists); sqliteman-1.2.2/sqliteman/qscintilla2/src/CallTip.cpp0000644000175000001440000002501111407213302022156 0ustar subzerousers// Scintilla source code edit control /** @file CallTip.cxx ** Code for displaying call tips. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include "Platform.h" #include "Scintilla.h" #include "CallTip.h" #include #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static const int insetX = 5; // text inset in x from calltip border static const int widthArrow = 14; CallTip::CallTip() { wCallTip = 0; inCallTipMode = false; posStartCallTip = 0; val = 0; rectUp = PRectangle(0,0,0,0); rectDown = PRectangle(0,0,0,0); lineHeight = 1; startHighlight = 0; endHighlight = 0; tabSize = 0; useStyleCallTip = false; // for backwards compatibility #ifdef __APPLE__ // proper apple colours for the default colourBG.desired = ColourDesired(0xff, 0xff, 0xc6); colourUnSel.desired = ColourDesired(0, 0, 0); #else colourBG.desired = ColourDesired(0xff, 0xff, 0xff); colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80); #endif colourSel.desired = ColourDesired(0, 0, 0x80); colourShade.desired = ColourDesired(0, 0, 0); colourLight.desired = ColourDesired(0xc0, 0xc0, 0xc0); } CallTip::~CallTip() { font.Release(); wCallTip.Destroy(); delete []val; val = 0; } void CallTip::RefreshColourPalette(Palette &pal, bool want) { pal.WantFind(colourBG, want); pal.WantFind(colourUnSel, want); pal.WantFind(colourSel, want); pal.WantFind(colourShade, want); pal.WantFind(colourLight, want); } // Although this test includes 0, we should never see a \0 character. static bool IsArrowCharacter(char ch) { return (ch == 0) || (ch == '\001') || (ch == '\002'); } // We ignore tabs unless a tab width has been set. bool CallTip::IsTabCharacter(char ch) { return (tabSize > 0) && (ch == '\t'); } int CallTip::NextTabPos(int x) { if (tabSize > 0) { // paranoia... not called unless this is true x -= insetX; // position relative to text x = (x + tabSize) / tabSize; // tab "number" return tabSize*x + insetX; // position of next tab } else { return x + 1; // arbitrary } } // Draw a section of the call tip that does not include \n in one colour. // The text may include up to numEnds tabs or arrow characters. void CallTip::DrawChunk(Surface *surface, int &x, const char *s, int posStart, int posEnd, int ytext, PRectangle rcClient, bool highlight, bool draw) { s += posStart; int len = posEnd - posStart; // Divide the text into sections that are all text, or that are // single arrows or single tab characters (if tabSize > 0). int maxEnd = 0; const int numEnds = 10; int ends[numEnds + 2]; for (int i=0;i 0) ends[maxEnd++] = i; ends[maxEnd++] = i+1; } } ends[maxEnd++] = len; int startSeg = 0; int xEnd; for (int seg = 0; seg startSeg) { if (IsArrowCharacter(s[startSeg])) { bool upArrow = s[startSeg] == '\001'; rcClient.left = x; rcClient.right = rcClient.left + widthArrow; if (draw) { const int halfWidth = widthArrow / 2 - 3; const int centreX = rcClient.left + widthArrow / 2 - 1; const int centreY = (rcClient.top + rcClient.bottom) / 2; surface->FillRectangle(rcClient, colourBG.allocated); PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1, rcClient.right - 2, rcClient.bottom - 1); surface->FillRectangle(rcClientInner, colourUnSel.allocated); if (upArrow) { // Up arrow Point pts[] = { Point(centreX - halfWidth, centreY + halfWidth / 2), Point(centreX + halfWidth, centreY + halfWidth / 2), Point(centreX, centreY - halfWidth + halfWidth / 2), }; surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), colourBG.allocated, colourBG.allocated); } else { // Down arrow Point pts[] = { Point(centreX - halfWidth, centreY - halfWidth / 2), Point(centreX + halfWidth, centreY - halfWidth / 2), Point(centreX, centreY + halfWidth - halfWidth / 2), }; surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), colourBG.allocated, colourBG.allocated); } } xEnd = rcClient.right; offsetMain = xEnd; if (upArrow) { rectUp = rcClient; } else { rectDown = rcClient; } } else if (IsTabCharacter(s[startSeg])) { xEnd = NextTabPos(x); } else { xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg); if (draw) { rcClient.left = x; rcClient.right = xEnd; surface->DrawTextTransparent(rcClient, font, ytext, s+startSeg, endSeg - startSeg, highlight ? colourSel.allocated : colourUnSel.allocated); } } x = xEnd; startSeg = endSeg; } } } int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { PRectangle rcClientPos = wCallTip.GetClientPosition(); PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, rcClientPos.bottom - rcClientPos.top); PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); // To make a nice small call tip window, it is only sized to fit most normal characters without accents int ascent = surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font); // For each line... // Draw the definition in three parts: before highlight, highlighted, after highlight int ytext = rcClient.top + ascent + 1; rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1; char *chunkVal = val; bool moreChunks = true; int maxWidth = 0; while (moreChunks) { char *chunkEnd = strchr(chunkVal, '\n'); if (chunkEnd == NULL) { chunkEnd = chunkVal + strlen(chunkVal); moreChunks = false; } int chunkOffset = chunkVal - val; int chunkLength = chunkEnd - chunkVal; int chunkEndOffset = chunkOffset + chunkLength; int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset); thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset); thisStartHighlight -= chunkOffset; int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset); thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset); thisEndHighlight -= chunkOffset; rcClient.top = ytext - ascent - 1; int x = insetX; // start each line at this inset DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight, ytext, rcClient, false, draw); DrawChunk(surfaceWindow, x, chunkVal, thisStartHighlight, thisEndHighlight, ytext, rcClient, true, draw); DrawChunk(surfaceWindow, x, chunkVal, thisEndHighlight, chunkLength, ytext, rcClient, false, draw); chunkVal = chunkEnd + 1; ytext += lineHeight; rcClient.bottom += lineHeight; maxWidth = Platform::Maximum(maxWidth, x); } return maxWidth; } void CallTip::PaintCT(Surface *surfaceWindow) { if (!val) return; PRectangle rcClientPos = wCallTip.GetClientPosition(); PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, rcClientPos.bottom - rcClientPos.top); PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); surfaceWindow->FillRectangle(rcClient, colourBG.allocated); offsetMain = insetX; // initial alignment assuming no arrows PaintContents(surfaceWindow, true); #ifndef __APPLE__ // OSX doesn't put borders on "help tags" // Draw a raised border around the edges of the window surfaceWindow->MoveTo(0, rcClientSize.bottom - 1); surfaceWindow->PenColour(colourShade.allocated); surfaceWindow->LineTo(rcClientSize.right - 1, rcClientSize.bottom - 1); surfaceWindow->LineTo(rcClientSize.right - 1, 0); surfaceWindow->PenColour(colourLight.allocated); surfaceWindow->LineTo(0, 0); surfaceWindow->LineTo(0, rcClientSize.bottom - 1); #endif } void CallTip::MouseClick(Point pt) { clickPlace = 0; if (rectUp.Contains(pt)) clickPlace = 1; if (rectDown.Contains(pt)) clickPlace = 2; } PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, const char *faceName, int size, int codePage_, int characterSet, Window &wParent) { clickPlace = 0; if (val) delete []val; val = new char[strlen(defn) + 1]; if (!val) return PRectangle(); strcpy(val, defn); codePage = codePage_; Surface *surfaceMeasure = Surface::Allocate(); if (!surfaceMeasure) return PRectangle(); surfaceMeasure->Init(wParent.GetID()); surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == codePage); surfaceMeasure->SetDBCSMode(codePage); startHighlight = 0; endHighlight = 0; inCallTipMode = true; posStartCallTip = pos; int deviceHeight = surfaceMeasure->DeviceHeightFont(size); font.Create(faceName, characterSet, deviceHeight, false, false); // Look for multiple lines in the text // Only support \n here - simply means container must avoid \r! int numLines = 1; const char *newline; const char *look = val; rectUp = PRectangle(0,0,0,0); rectDown = PRectangle(0,0,0,0); offsetMain = insetX; // changed to right edge of any arrows int width = PaintContents(surfaceMeasure, false) + insetX; while ((newline = strchr(look, '\n')) != NULL) { look = newline + 1; numLines++; } lineHeight = surfaceMeasure->Height(font); // Extra line for border and an empty line at top and bottom. The returned // rectangle is aligned to the right edge of the last arrow encountered in // the tip text, else to the tip text left edge. int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + 2 + 2; delete surfaceMeasure; return PRectangle(pt.x - offsetMain, pt.y + 1, pt.x + width - offsetMain, pt.y + 1 + height); } void CallTip::CallTipCancel() { inCallTipMode = false; if (wCallTip.Created()) { wCallTip.Destroy(); } } void CallTip::SetHighlight(int start, int end) { // Avoid flashing by checking something has really changed if ((start != startHighlight) || (end != endHighlight)) { startHighlight = start; endHighlight = end; if (wCallTip.Created()) { wCallTip.InvalidateAll(); } } } // Set the tab size (sizes > 0 enable the use of tabs). This also enables the // use of the STYLE_CALLTIP. void CallTip::SetTabSize(int tabSz) { tabSize = tabSz; useStyleCallTip = true; } // It might be better to have two access functions for this and to use // them for all settings of colours. void CallTip::SetForeBack(const ColourPair &fore, const ColourPair &back) { colourBG = back; colourUnSel = fore; } sqliteman-1.2.2/sqliteman/qscintilla2/src/PropSet.cpp0000644000175000001440000007176511407213302022243 0ustar subzerousers// SciTE - Scintilla based Text Editor /** @file PropSet.cxx ** A Java style properties file module. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. // Maintain a dictionary of properties #include #include #include #include "Platform.h" #include "PropSet.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif // The comparison and case changing functions here assume ASCII // or extended ASCII such as the normal Windows code page. static inline char MakeUpperCase(char ch) { if (ch < 'a' || ch > 'z') return ch; else return static_cast(ch - 'a' + 'A'); } static inline bool IsLetter(char ch) { return ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')); } inline bool IsASpace(unsigned int ch) { return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); } int CompareCaseInsensitive(const char *a, const char *b) { while (*a && *b) { if (*a != *b) { char upperA = MakeUpperCase(*a); char upperB = MakeUpperCase(*b); if (upperA != upperB) return upperA - upperB; } a++; b++; } // Either *a or *b is nul return *a - *b; } int CompareNCaseInsensitive(const char *a, const char *b, size_t len) { while (*a && *b && len) { if (*a != *b) { char upperA = MakeUpperCase(*a); char upperB = MakeUpperCase(*b); if (upperA != upperB) return upperA - upperB; } a++; b++; len--; } if (len == 0) return 0; else // Either *a or *b is nul return *a - *b; } bool EqualCaseInsensitive(const char *a, const char *b) { return 0 == CompareCaseInsensitive(a, b); } // Since the CaseInsensitive functions declared in SString // are implemented here, I will for now put the non-inline // implementations of the SString members here as well, so // that I can quickly see what effect this has. SString::SString(int i) : sizeGrowth(sizeGrowthDefault) { char number[32]; sprintf(number, "%0d", i); s = StringAllocate(number); sSize = sLen = (s) ? strlen(s) : 0; } SString::SString(double d, int precision) : sizeGrowth(sizeGrowthDefault) { char number[32]; sprintf(number, "%.*f", precision, d); s = StringAllocate(number); sSize = sLen = (s) ? strlen(s) : 0; } bool SString::grow(lenpos_t lenNew) { while (sizeGrowth * 6 < lenNew) { sizeGrowth *= 2; } char *sNew = new char[lenNew + sizeGrowth + 1]; if (sNew) { if (s) { memcpy(sNew, s, sLen); delete []s; } s = sNew; s[sLen] = '\0'; sSize = lenNew + sizeGrowth; } return sNew != 0; } SString &SString::assign(const char *sOther, lenpos_t sSize_) { if (!sOther) { sSize_ = 0; } else if (sSize_ == measure_length) { sSize_ = strlen(sOther); } if (sSize > 0 && sSize_ <= sSize) { // Does not allocate new buffer if the current is big enough if (s && sSize_) { memcpy(s, sOther, sSize_); } s[sSize_] = '\0'; sLen = sSize_; } else { delete []s; s = StringAllocate(sOther, sSize_); if (s) { sSize = sSize_; // Allow buffer bigger than real string, thus providing space to grow sLen = sSize_; } else { sSize = sLen = 0; } } return *this; } bool SString::operator==(const SString &sOther) const { if ((s == 0) && (sOther.s == 0)) return true; if ((s == 0) || (sOther.s == 0)) return false; return strcmp(s, sOther.s) == 0; } bool SString::operator==(const char *sOther) const { if ((s == 0) && (sOther == 0)) return true; if ((s == 0) || (sOther == 0)) return false; return strcmp(s, sOther) == 0; } SString SString::substr(lenpos_t subPos, lenpos_t subLen) const { if (subPos >= sLen) { return SString(); // return a null string if start index is out of bounds } if ((subLen == measure_length) || (subPos + subLen > sLen)) { subLen = sLen - subPos; // can't substr past end of source string } return SString(s, subPos, subPos + subLen); } SString &SString::lowercase(lenpos_t subPos, lenpos_t subLen) { if ((subLen == measure_length) || (subPos + subLen > sLen)) { subLen = sLen - subPos; // don't apply past end of string } for (lenpos_t i = subPos; i < subPos + subLen; i++) { if (s[i] < 'A' || s[i] > 'Z') continue; else s[i] = static_cast(s[i] - 'A' + 'a'); } return *this; } SString &SString::uppercase(lenpos_t subPos, lenpos_t subLen) { if ((subLen == measure_length) || (subPos + subLen > sLen)) { subLen = sLen - subPos; // don't apply past end of string } for (lenpos_t i = subPos; i < subPos + subLen; i++) { if (s[i] < 'a' || s[i] > 'z') continue; else s[i] = static_cast(s[i] - 'a' + 'A'); } return *this; } SString &SString::append(const char *sOther, lenpos_t sLenOther, char sep) { if (!sOther) { return *this; } if (sLenOther == measure_length) { sLenOther = strlen(sOther); } int lenSep = 0; if (sLen && sep) { // Only add a separator if not empty lenSep = 1; } lenpos_t lenNew = sLen + sLenOther + lenSep; // Conservative about growing the buffer: don't do it, unless really needed if ((lenNew < sSize) || (grow(lenNew))) { if (lenSep) { s[sLen] = sep; sLen++; } memcpy(&s[sLen], sOther, sLenOther); sLen += sLenOther; s[sLen] = '\0'; } return *this; } SString &SString::insert(lenpos_t pos, const char *sOther, lenpos_t sLenOther) { if (!sOther || pos > sLen) { return *this; } if (sLenOther == measure_length) { sLenOther = strlen(sOther); } lenpos_t lenNew = sLen + sLenOther; // Conservative about growing the buffer: don't do it, unless really needed if ((lenNew < sSize) || grow(lenNew)) { lenpos_t moveChars = sLen - pos + 1; for (lenpos_t i = moveChars; i > 0; i--) { s[pos + sLenOther + i - 1] = s[pos + i - 1]; } memcpy(s + pos, sOther, sLenOther); sLen = lenNew; } return *this; } /** * Remove @a len characters from the @a pos position, included. * Characters at pos + len and beyond replace characters at pos. * If @a len is 0, or greater than the length of the string * starting at @a pos, the string is just truncated at @a pos. */ void SString::remove(lenpos_t pos, lenpos_t len) { if (pos >= sLen) { return; } if (len < 1 || pos + len >= sLen) { s[pos] = '\0'; sLen = pos; } else { for (lenpos_t i = pos; i < sLen - len + 1; i++) { s[i] = s[i+len]; } sLen -= len; } } bool SString::startswith(const char *prefix) { lenpos_t lenPrefix = strlen(prefix); if (lenPrefix > sLen) { return false; } return strncmp(s, prefix, lenPrefix) == 0; } bool SString::endswith(const char *suffix) { lenpos_t lenSuffix = strlen(suffix); if (lenSuffix > sLen) { return false; } return strncmp(s + sLen - lenSuffix, suffix, lenSuffix) == 0; } int SString::search(const char *sFind, lenpos_t start) const { if (start < sLen) { const char *sFound = strstr(s + start, sFind); if (sFound) { return sFound - s; } } return -1; } int SString::substitute(char chFind, char chReplace) { int c = 0; char *t = s; while (t) { t = strchr(t, chFind); if (t) { *t = chReplace; t++; c++; } } return c; } int SString::substitute(const char *sFind, const char *sReplace) { int c = 0; lenpos_t lenFind = strlen(sFind); lenpos_t lenReplace = strlen(sReplace); int posFound = search(sFind); while (posFound >= 0) { remove(posFound, lenFind); insert(posFound, sReplace, lenReplace); posFound = search(sFind, posFound + lenReplace); c++; } return c; } char *SContainer::StringAllocate(lenpos_t len) { if (len != measure_length) { return new char[len + 1]; } else { return 0; } } char *SContainer::StringAllocate(const char *s, lenpos_t len) { if (s == 0) { return 0; } if (len == measure_length) { len = strlen(s); } char *sNew = new char[len + 1]; if (sNew) { memcpy(sNew, s, len); sNew[len] = '\0'; } return sNew; } // End SString functions bool PropSet::caseSensitiveFilenames = false; PropSet::PropSet() { superPS = 0; for (int root = 0; root < hashRoots; root++) props[root] = 0; } PropSet::~PropSet() { superPS = 0; Clear(); } void PropSet::Set(const char *key, const char *val, int lenKey, int lenVal) { if (!*key) // Empty keys are not supported return; if (lenKey == -1) lenKey = static_cast(strlen(key)); if (lenVal == -1) lenVal = static_cast(strlen(val)); unsigned int hash = HashString(key, lenKey); for (Property *p = props[hash % hashRoots]; p; p = p->next) { if ((hash == p->hash) && ((strlen(p->key) == static_cast(lenKey)) && (0 == strncmp(p->key, key, lenKey)))) { // Replace current value delete [](p->val); p->val = StringDup(val, lenVal); return; } } // Not found Property *pNew = new Property; if (pNew) { pNew->hash = hash; pNew->key = StringDup(key, lenKey); pNew->val = StringDup(val, lenVal); pNew->next = props[hash % hashRoots]; props[hash % hashRoots] = pNew; } } void PropSet::Set(const char *keyVal) { while (IsASpace(*keyVal)) keyVal++; const char *endVal = keyVal; while (*endVal && (*endVal != '\n')) endVal++; const char *eqAt = strchr(keyVal, '='); if (eqAt) { Set(keyVal, eqAt + 1, eqAt-keyVal, endVal - eqAt - 1); } else if (*keyVal) { // No '=' so assume '=1' Set(keyVal, "1", endVal-keyVal, 1); } } void PropSet::Unset(const char *key, int lenKey) { if (!*key) // Empty keys are not supported return; if (lenKey == -1) lenKey = static_cast(strlen(key)); unsigned int hash = HashString(key, lenKey); Property *pPrev = NULL; for (Property *p = props[hash % hashRoots]; p; p = p->next) { if ((hash == p->hash) && ((strlen(p->key) == static_cast(lenKey)) && (0 == strncmp(p->key, key, lenKey)))) { if (pPrev) pPrev->next = p->next; else props[hash % hashRoots] = p->next; if (p == enumnext) enumnext = p->next; // Not that anyone should mix enum and Set / Unset. delete [](p->key); delete [](p->val); delete p; return; } else { pPrev = p; } } } void PropSet::SetMultiple(const char *s) { const char *eol = strchr(s, '\n'); while (eol) { Set(s); s = eol + 1; eol = strchr(s, '\n'); } Set(s); } SString PropSet::Get(const char *key) { unsigned int hash = HashString(key, strlen(key)); for (Property *p = props[hash % hashRoots]; p; p = p->next) { if ((hash == p->hash) && (0 == strcmp(p->key, key))) { return p->val; } } if (superPS) { // Failed here, so try in base property set return superPS->Get(key); } else { return ""; } } bool PropSet::IncludesVar(const char *value, const char *key) { const char *var = strstr(value, "$("); while (var) { if (isprefix(var + 2, key) && (var[2 + strlen(key)] == ')')) { // Found $(key) which would lead to an infinite loop so exit return true; } var = strstr(var + 2, ")"); if (var) var = strstr(var + 1, "$("); } return false; } // There is some inconsistency between GetExpanded("foo") and Expand("$(foo)"). // A solution is to keep a stack of variables that have been expanded, so that // recursive expansions can be skipped. For now I'll just use the C++ stack // for that, through a recursive function and a simple chain of pointers. struct VarChain { VarChain(const char*var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {} bool contains(const char *testVar) const { return (var && (0 == strcmp(var, testVar))) || (link && link->contains(testVar)); } const char *var; const VarChain *link; }; static int ExpandAllInPlace(PropSet &props, SString &withVars, int maxExpands, const VarChain &blankVars = VarChain()) { int varStart = withVars.search("$("); while ((varStart >= 0) && (maxExpands > 0)) { int varEnd = withVars.search(")", varStart+2); if (varEnd < 0) { break; } // For consistency, when we see '$(ab$(cde))', expand the inner variable first, // regardless whether there is actually a degenerate variable named 'ab$(cde'. int innerVarStart = withVars.search("$(", varStart+2); while ((innerVarStart > varStart) && (innerVarStart < varEnd)) { varStart = innerVarStart; innerVarStart = withVars.search("$(", varStart+2); } SString var(withVars.c_str(), varStart + 2, varEnd); SString val = props.Get(var.c_str()); if (blankVars.contains(var.c_str())) { val.clear(); // treat blankVar as an empty string (e.g. to block self-reference) } if (--maxExpands >= 0) { maxExpands = ExpandAllInPlace(props, val, maxExpands, VarChain(var.c_str(), &blankVars)); } withVars.remove(varStart, varEnd-varStart+1); withVars.insert(varStart, val.c_str(), val.length()); varStart = withVars.search("$("); } return maxExpands; } SString PropSet::GetExpanded(const char *key) { SString val = Get(key); ExpandAllInPlace(*this, val, 100, VarChain(key)); return val; } SString PropSet::Expand(const char *withVars, int maxExpands) { SString val = withVars; ExpandAllInPlace(*this, val, maxExpands); return val; } int PropSet::GetInt(const char *key, int defaultValue) { SString val = GetExpanded(key); if (val.length()) return val.value(); return defaultValue; } bool isprefix(const char *target, const char *prefix) { while (*target && *prefix) { if (*target != *prefix) return false; target++; prefix++; } if (*prefix) return false; else return true; } static bool IsSuffix(const char *target, const char *suffix, bool caseSensitive) { size_t lentarget = strlen(target); size_t lensuffix = strlen(suffix); if (lensuffix > lentarget) return false; if (caseSensitive) { for (int i = static_cast(lensuffix) - 1; i >= 0; i--) { if (target[i + lentarget - lensuffix] != suffix[i]) return false; } } else { for (int i = static_cast(lensuffix) - 1; i >= 0; i--) { if (MakeUpperCase(target[i + lentarget - lensuffix]) != MakeUpperCase(suffix[i])) return false; } } return true; } SString PropSet::GetWild(const char *keybase, const char *filename) { for (int root = 0; root < hashRoots; root++) { for (Property *p = props[root]; p; p = p->next) { if (isprefix(p->key, keybase)) { char * orgkeyfile = p->key + strlen(keybase); char *keyfile = NULL; if (strstr(orgkeyfile, "$(") == orgkeyfile) { char *cpendvar = strchr(orgkeyfile, ')'); if (cpendvar) { *cpendvar = '\0'; SString s = GetExpanded(orgkeyfile + 2); *cpendvar = ')'; keyfile = StringDup(s.c_str()); } } char *keyptr = keyfile; if (keyfile == NULL) keyfile = orgkeyfile; for (;;) { char *del = strchr(keyfile, ';'); if (del == NULL) del = keyfile + strlen(keyfile); char delchr = *del; *del = '\0'; if (*keyfile == '*') { if (IsSuffix(filename, keyfile + 1, caseSensitiveFilenames)) { *del = delchr; delete []keyptr; return p->val; } } else if (0 == strcmp(keyfile, filename)) { *del = delchr; delete []keyptr; return p->val; } if (delchr == '\0') break; *del = delchr; keyfile = del + 1; } delete []keyptr; if (0 == strcmp(p->key, keybase)) { return p->val; } } } } if (superPS) { // Failed here, so try in base property set return superPS->GetWild(keybase, filename); } else { return ""; } } // GetNewExpand does not use Expand as it has to use GetWild with the filename for each // variable reference found. SString PropSet::GetNewExpand(const char *keybase, const char *filename) { char *base = StringDup(GetWild(keybase, filename).c_str()); char *cpvar = strstr(base, "$("); int maxExpands = 1000; // Avoid infinite expansion of recursive definitions while (cpvar && (maxExpands > 0)) { char *cpendvar = strchr(cpvar, ')'); if (cpendvar) { int lenvar = cpendvar - cpvar - 2; // Subtract the $() char *var = StringDup(cpvar + 2, lenvar); SString val = GetWild(var, filename); if (0 == strcmp(var, keybase)) val.clear(); // Self-references evaluate to empty string size_t newlenbase = strlen(base) + val.length() - lenvar; char *newbase = new char[newlenbase]; strncpy(newbase, base, cpvar - base); strcpy(newbase + (cpvar - base), val.c_str()); strcpy(newbase + (cpvar - base) + val.length(), cpendvar + 1); delete []var; delete []base; base = newbase; } cpvar = strstr(base, "$("); maxExpands--; } SString sret = base; delete []base; return sret; } void PropSet::Clear() { for (int root = 0; root < hashRoots; root++) { Property *p = props[root]; while (p) { Property *pNext = p->next; p->hash = 0; delete []p->key; p->key = 0; delete []p->val; p->val = 0; delete p; p = pNext; } props[root] = 0; } } char *PropSet::ToString() { size_t len=0; for (int r = 0; r < hashRoots; r++) { for (Property *p = props[r]; p; p = p->next) { len += strlen(p->key) + 1; len += strlen(p->val) + 1; } } if (len == 0) len = 1; // Return as empty string char *ret = new char [len]; if (ret) { char *w = ret; for (int root = 0; root < hashRoots; root++) { for (Property *p = props[root]; p; p = p->next) { strcpy(w, p->key); w += strlen(p->key); *w++ = '='; strcpy(w, p->val); w += strlen(p->val); *w++ = '\n'; } } ret[len-1] = '\0'; } return ret; } /** * Initiate enumeration. */ bool PropSet::GetFirst(char **key, char **val) { for (int i = 0; i < hashRoots; i++) { for (Property *p = props[i]; p; p = p->next) { if (p) { *key = p->key; *val = p->val; enumnext = p->next; // GetNext will begin here ... enumhash = i; // ... in this block return true; } } } return false; } /** * Continue enumeration. */ bool PropSet::GetNext(char ** key, char ** val) { bool firstloop = true; // search begins where we left it : in enumhash block for (int i = enumhash; i < hashRoots; i++) { if (!firstloop) enumnext = props[i]; // Begin with first property in block // else : begin where we left firstloop = false; for (Property *p = enumnext; p; p = p->next) { if (p) { *key = p->key; *val = p->val; enumnext = p->next; // for GetNext enumhash = i; return true; } } } return false; } /** * Creates an array that points into each word in the string and puts \0 terminators * after each word. */ static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) { int prev = '\n'; int words = 0; // For rapid determination of whether a character is a separator, build // a look up table. bool wordSeparator[256]; for (int i=0;i<256; i++) { wordSeparator[i] = false; } wordSeparator['\r'] = true; wordSeparator['\n'] = true; if (!onlyLineEnds) { wordSeparator[' '] = true; wordSeparator['\t'] = true; } for (int j = 0; wordlist[j]; j++) { int curr = static_cast(wordlist[j]); if (!wordSeparator[curr] && wordSeparator[prev]) words++; prev = curr; } char **keywords = new char *[words + 1]; if (keywords) { words = 0; prev = '\0'; size_t slen = strlen(wordlist); for (size_t k = 0; k < slen; k++) { if (!wordSeparator[static_cast(wordlist[k])]) { if (!prev) { keywords[words] = &wordlist[k]; words++; } } else { wordlist[k] = '\0'; } prev = wordlist[k]; } keywords[words] = &wordlist[slen]; *len = words; } else { *len = 0; } return keywords; } void WordList::Clear() { if (words) { delete []list; delete []words; delete []wordsNoCase; } words = 0; wordsNoCase = 0; list = 0; len = 0; sorted = false; sortedNoCase = false; } void WordList::Set(const char *s) { list = StringDup(s); sorted = false; sortedNoCase = false; words = ArrayFromWordList(list, &len, onlyLineEnds); wordsNoCase = new char * [len + 1]; memcpy(wordsNoCase, words, (len + 1) * sizeof (*words)); } char *WordList::Allocate(int size) { list = new char[size + 1]; list[size] = '\0'; return list; } void WordList::SetFromAllocated() { sorted = false; sortedNoCase = false; words = ArrayFromWordList(list, &len, onlyLineEnds); wordsNoCase = new char * [len + 1]; memcpy(wordsNoCase, words, (len + 1) * sizeof (*words)); } extern "C" int cmpString(const void *a1, const void *a2) { // Can't work out the correct incantation to use modern casts here return strcmp(*(char**)(a1), *(char**)(a2)); } extern "C" int cmpStringNoCase(const void *a1, const void *a2) { // Can't work out the correct incantation to use modern casts here return CompareCaseInsensitive(*(char**)(a1), *(char**)(a2)); } static void SortWordList(char **words, unsigned int len) { qsort(reinterpret_cast(words), len, sizeof(*words), cmpString); } static void SortWordListNoCase(char **wordsNoCase, unsigned int len) { qsort(reinterpret_cast(wordsNoCase), len, sizeof(*wordsNoCase), cmpStringNoCase); } bool WordList::InList(const char *s) { if (0 == words) return false; if (!sorted) { sorted = true; SortWordList(words, len); for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) starts[k] = -1; for (int l = len - 1; l >= 0; l--) { unsigned char indexChar = words[l][0]; starts[indexChar] = l; } } unsigned char firstChar = s[0]; int j = starts[firstChar]; if (j >= 0) { while (words[j][0] == firstChar) { if (s[1] == words[j][1]) { const char *a = words[j] + 1; const char *b = s + 1; while (*a && *a == *b) { a++; b++; } if (!*a && !*b) return true; } j++; } } j = starts['^']; if (j >= 0) { while (words[j][0] == '^') { const char *a = words[j] + 1; const char *b = s; while (*a && *a == *b) { a++; b++; } if (!*a) return true; j++; } } return false; } /** similar to InList, but word s can be a substring of keyword. * eg. the keyword define is defined as def~ine. This means the word must start * with def to be a keyword, but also defi, defin and define are valid. * The marker is ~ in this case. */ bool WordList::InListAbbreviated(const char *s, const char marker) { if (0 == words) return false; if (!sorted) { sorted = true; SortWordList(words, len); for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) starts[k] = -1; for (int l = len - 1; l >= 0; l--) { unsigned char indexChar = words[l][0]; starts[indexChar] = l; } } unsigned char firstChar = s[0]; int j = starts[firstChar]; if (j >= 0) { while (words[j][0] == firstChar) { bool isSubword = false; int start = 1; if (words[j][1] == marker) { isSubword = true; start++; } if (s[1] == words[j][start]) { const char *a = words[j] + start; const char *b = s + 1; while (*a && *a == *b) { a++; if (*a == marker) { isSubword = true; a++; } b++; } if ((!*a || isSubword) && !*b) return true; } j++; } } j = starts['^']; if (j >= 0) { while (words[j][0] == '^') { const char *a = words[j] + 1; const char *b = s; while (*a && *a == *b) { a++; b++; } if (!*a) return true; j++; } } return false; } /** * Returns an element (complete) of the wordlist array which has * the same beginning as the passed string. * The length of the word to compare is passed too. * Letter case can be ignored or preserved (default). */ const char *WordList::GetNearestWord(const char *wordStart, int searchLen, bool ignoreCase /*= false*/, SString wordCharacters /*='/0' */, int wordIndex /*= -1 */) { int start = 0; // lower bound of the api array block to search int end = len - 1; // upper bound of the api array block to search int pivot; // index of api array element just being compared int cond; // comparison result (in the sense of strcmp() result) const char *word; // api array element just being compared if (0 == words) return NULL; if (ignoreCase) { if (!sortedNoCase) { sortedNoCase = true; SortWordListNoCase(wordsNoCase, len); } while (start <= end) { // binary searching loop pivot = (start + end) >> 1; word = wordsNoCase[pivot]; cond = CompareNCaseInsensitive(wordStart, word, searchLen); if (!cond) { // find first word start = pivot; while (start > 0 && !CompareNCaseInsensitive(wordStart, wordsNoCase[start-1], searchLen)) { start--; } // find last word end = pivot; while (end < len-1 && !CompareNCaseInsensitive(wordStart, wordsNoCase[end+1], searchLen)) { end++; } // Finds first word in a series of equal words for (pivot = start; pivot <= end; pivot++) { word = wordsNoCase[pivot]; if (!wordCharacters.contains(word[searchLen])) { if (wordIndex <= 0) // Checks if a specific index was requested return word; // result must not be freed with free() wordIndex--; } } return NULL; } else if (cond > 0) start = pivot + 1; else if (cond < 0) end = pivot - 1; } } else { // preserve the letter case if (!sorted) { sorted = true; SortWordList(words, len); } while (start <= end) { // binary searching loop pivot = (start + end) >> 1; word = words[pivot]; cond = strncmp(wordStart, word, searchLen); if (!cond) { // find first word start = pivot; while (start > 0 && !strncmp(wordStart, words[start-1], searchLen)) { start--; } // find last word end = pivot; while (end < len-1 && !strncmp(wordStart, words[end+1], searchLen)) { end++; } // Finds first word in a series of equal words pivot = start; while (pivot <= end) { word = words[pivot]; if (!wordCharacters.contains(word[searchLen])) { if (wordIndex <= 0) // Checks if a specific index was requested return word; // result must not be freed with free() wordIndex--; } pivot++; } return NULL; } else if (cond > 0) start = pivot + 1; else if (cond < 0) end = pivot - 1; } } return NULL; } /** * Find the length of a 'word' which is actually an identifier in a string * which looks like "identifier(..." or "identifier" and where * there may be extra spaces after the identifier that should not be * counted in the length. */ static unsigned int LengthWord(const char *word, char otherSeparator) { const char *endWord = 0; // Find an otherSeparator if (otherSeparator) endWord = strchr(word, otherSeparator); // Find a '('. If that fails go to the end of the string. if (!endWord) endWord = strchr(word, '('); if (!endWord) endWord = word + strlen(word); // Last case always succeeds so endWord != 0 // Drop any space characters. if (endWord > word) { endWord--; // Back from the '(', otherSeparator, or '\0' // Move backwards over any spaces while ((endWord > word) && (IsASpace(*endWord))) { endWord--; } } return endWord - word; } /** * Returns elements (first words of them) of the wordlist array which have * the same beginning as the passed string. * The length of the word to compare is passed too. * Letter case can be ignored or preserved (default). * If there are more words meeting the condition they are returned all of * them in the ascending order separated with spaces. * * NOTE: returned buffer has to be freed with delete[]. */ char *WordList::GetNearestWords( const char *wordStart, int searchLen, bool ignoreCase /*= false*/, char otherSeparator /*= '\0'*/, bool exactLen /*=false*/) { unsigned int wordlen; // length of the word part (before the '(' brace) of the api array element SString wordsNear; wordsNear.setsizegrowth(1000); int start = 0; // lower bound of the api array block to search int end = len - 1; // upper bound of the api array block to search int pivot; // index of api array element just being compared int cond; // comparison result (in the sense of strcmp() result) if (0 == words) return NULL; if (ignoreCase) { if (!sortedNoCase) { sortedNoCase = true; SortWordListNoCase(wordsNoCase, len); } while (start <= end) { // Binary searching loop pivot = (start + end) / 2; cond = CompareNCaseInsensitive(wordStart, wordsNoCase[pivot], searchLen); if (!cond) { // Find first match while ((pivot > start) && (0 == CompareNCaseInsensitive(wordStart, wordsNoCase[pivot-1], searchLen))) { --pivot; } // Grab each match while ((pivot <= end) && (0 == CompareNCaseInsensitive(wordStart, wordsNoCase[pivot], searchLen))) { wordlen = LengthWord(wordsNoCase[pivot], otherSeparator) + 1; ++pivot; if (exactLen && wordlen != LengthWord(wordStart, otherSeparator) + 1) continue; wordsNear.append(wordsNoCase[pivot-1], wordlen, ' '); } return wordsNear.detach(); } else if (cond < 0) { end = pivot - 1; } else if (cond > 0) { start = pivot + 1; } } } else { // Preserve the letter case if (!sorted) { sorted = true; SortWordList(words, len); } while (start <= end) { // Binary searching loop pivot = (start + end) / 2; cond = strncmp(wordStart, words[pivot], searchLen); if (!cond) { // Find first match while ((pivot > start) && (0 == strncmp(wordStart, words[pivot-1], searchLen))) { --pivot; } // Grab each match while ((pivot <= end) && (0 == strncmp(wordStart, words[pivot], searchLen))) { wordlen = LengthWord(words[pivot], otherSeparator) + 1; ++pivot; if (exactLen && wordlen != LengthWord(wordStart, otherSeparator) + 1) continue; wordsNear.append(words[pivot-1], wordlen, ' '); } return wordsNear.detach(); } else if (cond < 0) { end = pivot - 1; } else if (cond > 0) { start = pivot + 1; } } } return NULL; } sqliteman-1.2.2/sqliteman/qscintilla2/src/Style.h0000644000175000001440000000302111407213302021370 0ustar subzerousers// Scintilla source code edit control /** @file Style.h ** Defines the font and colour style for a class of text. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef STYLE_H #define STYLE_H #ifdef SCI_NAMESPACE namespace Scintilla { #endif /** */ class Style { public: ColourPair fore; ColourPair back; bool aliasOfDefaultFont; bool bold; bool italic; int size; const char *fontName; int characterSet; bool eolFilled; bool underline; enum ecaseForced {caseMixed, caseUpper, caseLower}; ecaseForced caseForce; bool visible; bool changeable; bool hotspot; Font font; int sizeZoomed; unsigned int lineHeight; unsigned int ascent; unsigned int descent; unsigned int externalLeading; unsigned int aveCharWidth; unsigned int spaceWidth; Style(); Style(const Style &source); ~Style(); Style &operator=(const Style &source); void Clear(ColourDesired fore_, ColourDesired back_, int size_, const char *fontName_, int characterSet_, bool bold_, bool italic_, bool eolFilled_, bool underline_, ecaseForced caseForce_, bool visible_, bool changeable_, bool hotspot_); void ClearTo(const Style &source); bool EquivalentFontTo(const Style *other) const; void Realise(Surface &surface, int zoomLevel, Style *defaultStyle = 0, bool extraFontFlag = false); bool IsProtected() const { return !(changeable && visible);}; }; #ifdef SCI_NAMESPACE } #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/Indicator.cpp0000644000175000001440000000437011407213302022547 0ustar subzerousers// Scintilla source code edit control /** @file Indicator.cxx ** Defines the style of indicators which are text decorations such as underlining. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include "Platform.h" #include "Scintilla.h" #include "Indicator.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) { surface->PenColour(fore.allocated); int ymid = (rc.bottom + rc.top) / 2; if (style == INDIC_SQUIGGLE) { surface->MoveTo(rc.left, rc.top); int x = rc.left + 2; int y = 2; while (x < rc.right) { surface->LineTo(x, rc.top + y); x += 2; y = 2 - y; } surface->LineTo(rc.right, rc.top + y); // Finish the line } else if (style == INDIC_TT) { surface->MoveTo(rc.left, ymid); int x = rc.left + 5; while (x < rc.right) { surface->LineTo(x, ymid); surface->MoveTo(x-3, ymid); surface->LineTo(x-3, ymid+2); x++; surface->MoveTo(x, ymid); x += 5; } surface->LineTo(rc.right, ymid); // Finish the line if (x - 3 <= rc.right) { surface->MoveTo(x-3, ymid); surface->LineTo(x-3, ymid+2); } } else if (style == INDIC_DIAGONAL) { int x = rc.left; while (x < rc.right) { surface->MoveTo(x, rc.top+2); int endX = x+3; int endY = rc.top - 1; if (endX > rc.right) { endY += endX - rc.right; endX = rc.right; } surface->LineTo(endX, endY); x += 4; } } else if (style == INDIC_STRIKE) { surface->MoveTo(rc.left, rc.top - 4); surface->LineTo(rc.right, rc.top - 4); } else if (style == INDIC_HIDDEN) { // Draw nothing } else if (style == INDIC_BOX) { surface->MoveTo(rc.left, ymid+1); surface->LineTo(rc.right, ymid+1); surface->LineTo(rc.right, rcLine.top+1); surface->LineTo(rc.left, rcLine.top+1); surface->LineTo(rc.left, ymid+1); } else if (style == INDIC_ROUNDBOX) { PRectangle rcBox = rcLine; rcBox.top = rcLine.top + 1; rcBox.left = rc.left; rcBox.right = rc.right; surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0); } else { // Either INDIC_PLAIN or unknown surface->MoveTo(rc.left, ymid); surface->LineTo(rc.right, ymid); } } sqliteman-1.2.2/sqliteman/qscintilla2/src/LexSpice.cpp0000644000175000001440000001502711407213302022350 0ustar subzerousers// Scintilla source code edit control /** @file LexSpice.cxx ** Lexer for Spice **/ // Copyright 2006 by Fabien Proriol // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include "Platform.h" #include "Accessor.h" #include "StyleContext.h" #include "PropSet.h" #include "KeyWords.h" #include "SciLexer.h" #include "SString.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif /* * Interface */ static void ColouriseDocument( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler); static const char * const spiceWordListDesc[] = { "Keywords", // SPICE command "Keywords2", // SPICE functions "Keywords3", // SPICE params 0 }; LexerModule lmSpice(SCLEX_SPICE, ColouriseDocument, "spice", NULL, spiceWordListDesc); /* * Implementation */ static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute); static inline bool IsDelimiterCharacter(int ch); static inline bool IsNumberStartCharacter(int ch); static inline bool IsNumberCharacter(int ch); static inline bool IsSeparatorOrDelimiterCharacter(int ch); static inline bool IsWordStartCharacter(int ch); static inline bool IsWordCharacter(int ch); static void ColouriseComment(StyleContext& sc, bool&) { sc.SetState(SCE_SPICE_COMMENTLINE); while (!sc.atLineEnd) { sc.Forward(); } } static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) { apostropheStartsAttribute = sc.Match (')'); sc.SetState(SCE_SPICE_DELIMITER); sc.ForwardSetState(SCE_SPICE_DEFAULT); } static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) { apostropheStartsAttribute = true; SString number; sc.SetState(SCE_SPICE_NUMBER); // Get all characters up to a delimiter or a separator, including points, but excluding // double points (ranges). while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) { number += static_cast(sc.ch); sc.Forward(); } // Special case: exponent with sign if ((sc.chPrev == 'e' || sc.chPrev == 'E') && (sc.ch == '+' || sc.ch == '-')) { number += static_cast(sc.ch); sc.Forward (); while (!IsSeparatorOrDelimiterCharacter(sc.ch)) { number += static_cast(sc.ch); sc.Forward(); } } sc.SetState(SCE_SPICE_DEFAULT); } static void ColouriseWhiteSpace(StyleContext& sc, bool& ) { sc.SetState(SCE_SPICE_DEFAULT); sc.ForwardSetState(SCE_SPICE_DEFAULT); } static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute) { apostropheStartsAttribute = true; sc.SetState(SCE_SPICE_IDENTIFIER); SString word; while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { word += static_cast(tolower(sc.ch)); sc.Forward(); } if (keywords.InList(word.c_str())) { sc.ChangeState(SCE_SPICE_KEYWORD); if (word != "all") { apostropheStartsAttribute = false; } } else if (keywords2.InList(word.c_str())) { sc.ChangeState(SCE_SPICE_KEYWORD2); if (word != "all") { apostropheStartsAttribute = false; } } else if (keywords3.InList(word.c_str())) { sc.ChangeState(SCE_SPICE_KEYWORD3); if (word != "all") { apostropheStartsAttribute = false; } } sc.SetState(SCE_SPICE_DEFAULT); } // // ColouriseDocument // static void ColouriseDocument( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; StyleContext sc(startPos, length, initStyle, styler); int lineCurrent = styler.GetLine(startPos); bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0; while (sc.More()) { if (sc.atLineEnd) { // Go to the next line sc.Forward(); lineCurrent++; // Remember the line state for future incremental lexing styler.SetLineState(lineCurrent, apostropheStartsAttribute); // Don't continue any styles on the next line sc.SetState(SCE_SPICE_DEFAULT); } // Comments if ((sc.Match('*') && sc.atLineStart) || sc.Match('*','~')) { ColouriseComment(sc, apostropheStartsAttribute); // Whitespace } else if (IsASpace(sc.ch)) { ColouriseWhiteSpace(sc, apostropheStartsAttribute); // Delimiters } else if (IsDelimiterCharacter(sc.ch)) { ColouriseDelimiter(sc, apostropheStartsAttribute); // Numbers } else if (IsADigit(sc.ch) || sc.ch == '#') { ColouriseNumber(sc, apostropheStartsAttribute); // Keywords or identifiers } else { ColouriseWord(sc, keywords, keywords2, keywords3, apostropheStartsAttribute); } } sc.Complete(); } static inline bool IsDelimiterCharacter(int ch) { switch (ch) { case '&': case '\'': case '(': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case ':': case ';': case '<': case '=': case '>': case '|': return true; default: return false; } } static inline bool IsNumberCharacter(int ch) { return IsNumberStartCharacter(ch) || ch == '_' || ch == '.' || ch == '#' || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'); } static inline bool IsNumberStartCharacter(int ch) { return IsADigit(ch); } static inline bool IsSeparatorOrDelimiterCharacter(int ch) { return IsASpace(ch) || IsDelimiterCharacter(ch); } static inline bool IsWordCharacter(int ch) { return IsWordStartCharacter(ch) || IsADigit(ch); } static inline bool IsWordStartCharacter(int ch) { return (isascii(ch) && isalpha(ch)) || ch == '_'; } sqliteman-1.2.2/sqliteman/qscintilla2/src/RunStyles.cpp0000644000175000001440000001260411407213302022602 0ustar subzerousers/** @file RunStyles.cxx ** Data structure used to store sparse styles. **/ // Copyright 1998-2007 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include "Platform.h" #include "Scintilla.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif // Find the first run at a position int RunStyles::RunFromPosition(int position) { int run = starts->PartitionFromPosition(position); // Go to first element with this position while ((run > 0) && (position == starts->PositionFromPartition(run-1))) { run--; } return run; } // If there is no run boundary at position, insert one continuing style. int RunStyles::SplitRun(int position) { int run = RunFromPosition(position); int posRun = starts->PositionFromPartition(run); if (posRun < position) { int runStyle = ValueAt(position); run++; starts->InsertPartition(run, position); styles->InsertValue(run, 1, runStyle); } return run; } void RunStyles::RemoveRun(int run) { starts->RemovePartition(run); styles->DeleteRange(run, 1); } void RunStyles::RemoveRunIfEmpty(int run) { if ((run < starts->Partitions()) && (starts->Partitions() > 1)) { if (starts->PositionFromPartition(run) == starts->PositionFromPartition(run+1)) { RemoveRun(run); } } } void RunStyles::RemoveRunIfSameAsPrevious(int run) { if ((run > 0) && (run < starts->Partitions())) { if (styles->ValueAt(run-1) == styles->ValueAt(run)) { RemoveRun(run); } } } RunStyles::RunStyles() { starts = new Partitioning(8); styles = new SplitVector(); styles->InsertValue(0, 2, 0); } RunStyles::~RunStyles() { delete starts; starts = NULL; delete styles; styles = NULL; } int RunStyles::Length() { return starts->PositionFromPartition(starts->Partitions()); } int RunStyles::ValueAt(int position) { return styles->ValueAt(starts->PartitionFromPosition(position)); } int RunStyles::FindNextChange(int position, int end) { int run = starts->PartitionFromPosition(position); if (run < starts->Partitions()) { int runChange = starts->PositionFromPartition(run); if (runChange > position) return runChange; int nextChange = starts->PositionFromPartition(run + 1); if (nextChange > position) { return nextChange; } else if (position < end) { return end; } else { return end + 1; } } else { return end + 1; } } int RunStyles::StartRun(int position) { return starts->PositionFromPartition(starts->PartitionFromPosition(position)); } int RunStyles::EndRun(int position) { return starts->PositionFromPartition(starts->PartitionFromPosition(position) + 1); } bool RunStyles::FillRange(int &position, int value, int &fillLength) { int end = position + fillLength; int runEnd = RunFromPosition(end); if (styles->ValueAt(runEnd) == value) { // End already has value so trim range. end = starts->PositionFromPartition(runEnd); if (position >= end) { // Whole range is already same as value so no action return false; } fillLength = end - position; } else { runEnd = SplitRun(end); } int runStart = RunFromPosition(position); if (styles->ValueAt(runStart) == value) { // Start is in expected value so trim range. runStart++; position = starts->PositionFromPartition(runStart); fillLength = end - position; } else { if (starts->PositionFromPartition(runStart) < position) { runStart = SplitRun(position); runEnd++; } } if (runStart < runEnd) { styles->SetValueAt(runStart, value); // Remove each old run over the range for (int run=runStart+1; runPositionFromPartition(runStart) == position) { int runStyle = ValueAt(position); // Inserting at start of run so make previous longer if (runStart == 0) { // Inserting at start of document so ensure 0 if (runStyle) { styles->SetValueAt(0, 0); starts->InsertPartition(1, 0); styles->InsertValue(1, 1, runStyle); starts->InsertText(0, insertLength); } else { starts->InsertText(runStart, insertLength); } } else { if (runStyle) { starts->InsertText(runStart-1, insertLength); } else { // Insert at end of run so do not extend style starts->InsertText(runStart, insertLength); } } } else { starts->InsertText(runStart, insertLength); } } void RunStyles::DeleteAll() { delete starts; starts = NULL; delete styles; styles = NULL; starts = new Partitioning(8); styles = new SplitVector(); styles->InsertValue(0, 2, 0); } void RunStyles::DeleteRange(int position, int deleteLength) { int end = position + deleteLength; int runStart = RunFromPosition(position); int runEnd = RunFromPosition(end); if (runStart == runEnd) { // Deleting from inside one run starts->InsertText(runStart, -deleteLength); } else { runStart = SplitRun(position); runEnd = SplitRun(end); starts->InsertText(runStart, -deleteLength); // Remove each old run over the range for (int run=runStart; run // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static bool Is0To9(char ch) { return (ch >= '0') && (ch <= '9'); } static bool Is1To9(char ch) { return (ch >= '1') && (ch <= '9'); } static inline bool AtEOL(Accessor &styler, unsigned int i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } // Tests for BATCH Operators static bool IsBOperator(char ch) { return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') || (ch == '|') || (ch == '?') || (ch == '*'); } // Tests for BATCH Separators static bool IsBSeparator(char ch) { return (ch == '\\') || (ch == '.') || (ch == ';') || (ch == '\"') || (ch == '\'') || (ch == '/') || (ch == ')'); } static void ColouriseBatchLine( char *lineBuffer, unsigned int lengthLine, unsigned int startLine, unsigned int endPos, WordList *keywordlists[], Accessor &styler) { unsigned int offset = 0; // Line Buffer Offset unsigned int enVarEnd; // Environment Variable End point unsigned int cmdLoc; // External Command / Program Location char wordBuffer[81]; // Word Buffer - large to catch long paths unsigned int wbl; // Word Buffer Length unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length WordList &keywords = *keywordlists[0]; // Internal Commands WordList &keywords2 = *keywordlists[1]; // External Commands (optional) // CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords // Toggling Regular Keyword Checking off improves readability // Other Regular Keywords and External Commands / Programs might also benefit from toggling // Need a more robust algorithm to properly toggle Regular Keyword Checking bool continueProcessing = true; // Used to toggle Regular Keyword Checking // Special Keywords are those that allow certain characters without whitespace after the command // Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path= // Special Keyword Buffer used to determine if the first n characters is a Keyword char sKeywordBuffer[10]; // Special Keyword Buffer bool sKeywordFound; // Exit Special Keyword for-loop if found // Skip initial spaces while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { offset++; } // Colorize Default Text styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); // Set External Command / Program Location cmdLoc = offset; // Check for Fake Label (Comment) or Real Label - return if found if (lineBuffer[offset] == ':') { if (lineBuffer[offset + 1] == ':') { // Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm styler.ColourTo(endPos, SCE_BAT_COMMENT); } else { // Colorize Real Label styler.ColourTo(endPos, SCE_BAT_LABEL); } return; // Check for Drive Change (Drive Change is internal command) - return if found } else if ((isalpha(lineBuffer[offset])) && (lineBuffer[offset + 1] == ':') && ((isspacechar(lineBuffer[offset + 2])) || (((lineBuffer[offset + 2] == '\\')) && (isspacechar(lineBuffer[offset + 3]))))) { // Colorize Regular Keyword styler.ColourTo(endPos, SCE_BAT_WORD); return; } // Check for Hide Command (@ECHO OFF/ON) if (lineBuffer[offset] == '@') { styler.ColourTo(startLine + offset, SCE_BAT_HIDE); offset++; // Check for Argument (%n) or Environment Variable (%x...%) } else if (lineBuffer[offset] == '%') { enVarEnd = offset + 1; // Search end of word for second % (can be a long path) while ((enVarEnd < lengthLine) && (!isspacechar(lineBuffer[enVarEnd])) && (lineBuffer[enVarEnd] != '%') && (!IsBOperator(lineBuffer[enVarEnd])) && (!IsBSeparator(lineBuffer[enVarEnd]))) { enVarEnd++; } // Check for Argument (%n) if ((Is0To9(lineBuffer[offset + 1])) && (lineBuffer[enVarEnd] != '%')) { // Colorize Argument styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER); offset += 2; // Check for External Command / Program if (offset < lengthLine && !isspacechar(lineBuffer[offset])) { cmdLoc = offset; } // Check for Environment Variable (%x...%) } else if ((lineBuffer[offset + 1] != '%') && (lineBuffer[enVarEnd] == '%')) { offset = enVarEnd; // Colorize Environment Variable styler.ColourTo(startLine + offset, SCE_BAT_IDENTIFIER); offset++; // Check for External Command / Program if (offset < lengthLine && !isspacechar(lineBuffer[offset])) { cmdLoc = offset; } } } // Skip next spaces while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { offset++; } // Read remainder of line word-at-a-time or remainder-of-word-at-a-time while (offset < lengthLine) { if (offset > startLine) { // Colorize Default Text styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); } // Copy word from Line Buffer into Word Buffer wbl = 0; for (; offset < lengthLine && wbl < 80 && !isspacechar(lineBuffer[offset]); wbl++, offset++) { wordBuffer[wbl] = static_cast(tolower(lineBuffer[offset])); } wordBuffer[wbl] = '\0'; wbo = 0; // Check for Comment - return if found if (CompareCaseInsensitive(wordBuffer, "rem") == 0) { styler.ColourTo(endPos, SCE_BAT_COMMENT); return; } // Check for Separator if (IsBSeparator(wordBuffer[0])) { // Check for External Command / Program if ((cmdLoc == offset - wbl) && ((wordBuffer[0] == ':') || (wordBuffer[0] == '\\') || (wordBuffer[0] == '.'))) { // Reset Offset to re-process remainder of word offset -= (wbl - 1); // Colorize External Command / Program if (!keywords2) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); } else if (keywords2.InList(wordBuffer)) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); } else { styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); } // Reset External Command / Program Location cmdLoc = offset; } else { // Reset Offset to re-process remainder of word offset -= (wbl - 1); // Colorize Default Text styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); } // Check for Regular Keyword in list } else if ((keywords.InList(wordBuffer)) && (continueProcessing)) { // ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) || (CompareCaseInsensitive(wordBuffer, "goto") == 0) || (CompareCaseInsensitive(wordBuffer, "prompt") == 0) || (CompareCaseInsensitive(wordBuffer, "set") == 0)) { continueProcessing = false; } // Identify External Command / Program Location for ERRORLEVEL, and EXIST if ((CompareCaseInsensitive(wordBuffer, "errorlevel") == 0) || (CompareCaseInsensitive(wordBuffer, "exist") == 0)) { // Reset External Command / Program Location cmdLoc = offset; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Skip comparison while ((cmdLoc < lengthLine) && (!isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Identify External Command / Program Location for CALL, DO, LOADHIGH and LH } else if ((CompareCaseInsensitive(wordBuffer, "call") == 0) || (CompareCaseInsensitive(wordBuffer, "do") == 0) || (CompareCaseInsensitive(wordBuffer, "loadhigh") == 0) || (CompareCaseInsensitive(wordBuffer, "lh") == 0)) { // Reset External Command / Program Location cmdLoc = offset; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } } // Colorize Regular keyword styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD); // No need to Reset Offset // Check for Special Keyword in list, External Command / Program, or Default Text } else if ((wordBuffer[0] != '%') && (!IsBOperator(wordBuffer[0])) && (continueProcessing)) { // Check for Special Keyword // Affected Commands are in Length range 2-6 // Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected sKeywordFound = false; for (unsigned int keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { wbo = 0; // Copy Keyword Length from Word Buffer into Special Keyword Buffer for (; wbo < keywordLength; wbo++) { sKeywordBuffer[wbo] = static_cast(wordBuffer[wbo]); } sKeywordBuffer[wbo] = '\0'; // Check for Special Keyword in list if ((keywords.InList(sKeywordBuffer)) && ((IsBOperator(wordBuffer[wbo])) || (IsBSeparator(wordBuffer[wbo])))) { sKeywordFound = true; // ECHO requires no further Regular Keyword Checking if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) { continueProcessing = false; } // Colorize Special Keyword as Regular Keyword styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); } } // Check for External Command / Program or Default Text if (!sKeywordFound) { wbo = 0; // Check for External Command / Program if (cmdLoc == offset - wbl) { // Read up to %, Operator or Separator while ((wbo < wbl) && (wordBuffer[wbo] != '%') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { wbo++; } // Reset External Command / Program Location cmdLoc = offset - (wbl - wbo); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); // CHOICE requires no further Regular Keyword Checking if (CompareCaseInsensitive(wordBuffer, "choice") == 0) { continueProcessing = false; } // Check for START (and its switches) - What follows is External Command \ Program if (CompareCaseInsensitive(wordBuffer, "start") == 0) { // Reset External Command / Program Location cmdLoc = offset; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Reset External Command / Program Location if command switch detected if (lineBuffer[cmdLoc] == '/') { // Skip command switch while ((cmdLoc < lengthLine) && (!isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } } } // Colorize External Command / Program if (!keywords2) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); } else if (keywords2.InList(wordBuffer)) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); } else { styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); } // No need to Reset Offset // Check for Default Text } else { // Read up to %, Operator or Separator while ((wbo < wbl) && (wordBuffer[wbo] != '%') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { wbo++; } // Colorize Default Text styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); } } // Check for Argument (%n), Environment Variable (%x...%) or Local Variable (%%a) } else if (wordBuffer[0] == '%') { // Colorize Default Text styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); wbo++; // Search to end of word for second % (can be a long path) while ((wbo < wbl) && (wordBuffer[wbo] != '%') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { wbo++; } // Check for Argument (%n) if ((Is0To9(wordBuffer[1])) && (wordBuffer[wbo] != '%')) { // Check for External Command / Program if (cmdLoc == offset - wbl) { cmdLoc = offset - (wbl - 2); } // Colorize Argument styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER); // Reset Offset to re-process remainder of word offset -= (wbl - 2); // Check for Environment Variable (%x...%) } else if ((wordBuffer[1] != '%') && (wordBuffer[wbo] == '%')) { wbo++; // Check for External Command / Program if (cmdLoc == offset - wbl) { cmdLoc = offset - (wbl - wbo); } // Colorize Environment Variable styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); // Check for Local Variable (%%a) } else if ( (wbl > 2) && (wordBuffer[1] == '%') && (wordBuffer[2] != '%') && (!IsBOperator(wordBuffer[2])) && (!IsBSeparator(wordBuffer[2]))) { // Check for External Command / Program if (cmdLoc == offset - wbl) { cmdLoc = offset - (wbl - 3); } // Colorize Local Variable styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER); // Reset Offset to re-process remainder of word offset -= (wbl - 3); } // Check for Operator } else if (IsBOperator(wordBuffer[0])) { // Colorize Default Text styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); // Check for Comparison Operator if ((wordBuffer[0] == '=') && (wordBuffer[1] == '=')) { // Identify External Command / Program Location for IF cmdLoc = offset; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Colorize Comparison Operator styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_OPERATOR); // Reset Offset to re-process remainder of word offset -= (wbl - 2); // Check for Pipe Operator } else if (wordBuffer[0] == '|') { // Reset External Command / Program Location cmdLoc = offset - wbl + 1; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Colorize Pipe Operator styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); // Reset Offset to re-process remainder of word offset -= (wbl - 1); // Check for Other Operator } else { // Check for > Operator if (wordBuffer[0] == '>') { // Turn Keyword and External Command / Program checking back on continueProcessing = true; } // Colorize Other Operator styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); // Reset Offset to re-process remainder of word offset -= (wbl - 1); } // Check for Default Text } else { // Read up to %, Operator or Separator while ((wbo < wbl) && (wordBuffer[wbo] != '%') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { wbo++; } // Colorize Default Text styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); } // Skip next spaces - nothing happens if Offset was Reset while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { offset++; } } // Colorize Default Text for remainder of line - currently not lexed styler.ColourTo(endPos, SCE_BAT_DEFAULT); } static void ColouriseBatchDoc( unsigned int startPos, int length, int /*initStyle*/, WordList *keywordlists[], Accessor &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); unsigned int linePos = 0; unsigned int startLine = startPos; for (unsigned int i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it lineBuffer[linePos] = '\0'; ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler); linePos = 0; startLine = i + 1; } } if (linePos > 0) { // Last line does not have ending characters lineBuffer[linePos] = '\0'; ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1, keywordlists, styler); } } static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) { // It is needed to remember the current state to recognize starting // comment lines before the first "diff " or "--- ". If a real // difference starts then each line starting with ' ' is a whitespace // otherwise it is considered a comment (Only in..., Binary file...) if (0 == strncmp(lineBuffer, "diff ", 5)) { styler.ColourTo(endLine, SCE_DIFF_COMMAND); } else if (0 == strncmp(lineBuffer, "--- ", 4)) { // In a context diff, --- appears in both the header and the position markers if (atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) styler.ColourTo(endLine, SCE_DIFF_POSITION); else styler.ColourTo(endLine, SCE_DIFF_HEADER); } else if (0 == strncmp(lineBuffer, "+++ ", 4)) { // I don't know of any diff where "+++ " is a position marker, but for // consistency, do the same as with "--- " and "*** ". if (atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) styler.ColourTo(endLine, SCE_DIFF_POSITION); else styler.ColourTo(endLine, SCE_DIFF_HEADER); } else if (0 == strncmp(lineBuffer, "====", 4)) { // For p4's diff styler.ColourTo(endLine, SCE_DIFF_HEADER); } else if (0 == strncmp(lineBuffer, "***", 3)) { // In a context diff, *** appears in both the header and the position markers. // Also ******** is a chunk header, but here it's treated as part of the // position marker since there is no separate style for a chunk header. if (lineBuffer[3] == ' ' && atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) styler.ColourTo(endLine, SCE_DIFF_POSITION); else if (lineBuffer[3] == '*') styler.ColourTo(endLine, SCE_DIFF_POSITION); else styler.ColourTo(endLine, SCE_DIFF_HEADER); } else if (0 == strncmp(lineBuffer, "? ", 2)) { // For difflib styler.ColourTo(endLine, SCE_DIFF_HEADER); } else if (lineBuffer[0] == '@') { styler.ColourTo(endLine, SCE_DIFF_POSITION); } else if (lineBuffer[0] >= '0' && lineBuffer[0] <= '9') { styler.ColourTo(endLine, SCE_DIFF_POSITION); } else if (lineBuffer[0] == '-' || lineBuffer[0] == '<') { styler.ColourTo(endLine, SCE_DIFF_DELETED); } else if (lineBuffer[0] == '+' || lineBuffer[0] == '>') { styler.ColourTo(endLine, SCE_DIFF_ADDED); } else if (lineBuffer[0] != ' ') { styler.ColourTo(endLine, SCE_DIFF_COMMENT); } else { styler.ColourTo(endLine, SCE_DIFF_DEFAULT); } } static void ColouriseDiffDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); unsigned int linePos = 0; for (unsigned int i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it lineBuffer[linePos] = '\0'; ColouriseDiffLine(lineBuffer, i, styler); linePos = 0; } } if (linePos > 0) { // Last line does not have ending characters ColouriseDiffLine(lineBuffer, startPos + length - 1, styler); } } static void FoldDiffDoc(unsigned int startPos, int length, int, WordList*[], Accessor &styler) { int curLine = styler.GetLine(startPos); int prevLevel = SC_FOLDLEVELBASE; if (curLine > 0) prevLevel = styler.LevelAt(curLine-1); int curLineStart = styler.LineStart(curLine); do { int nextLevel = prevLevel; if (prevLevel & SC_FOLDLEVELHEADERFLAG) nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1; int lineType = styler.StyleAt(curLineStart); if (lineType == SCE_DIFF_COMMAND) nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG; else if (lineType == SCE_DIFF_HEADER) { nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG; } else if (lineType == SCE_DIFF_POSITION) nextLevel = (SC_FOLDLEVELBASE + 3) | SC_FOLDLEVELHEADERFLAG; if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel)) styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG); styler.SetLevel(curLine, nextLevel); prevLevel = nextLevel; curLineStart = styler.LineStart(++curLine); } while (static_cast(startPos) + length > curLineStart); } static void ColourisePropsLine( char *lineBuffer, unsigned int lengthLine, unsigned int startLine, unsigned int endPos, Accessor &styler) { unsigned int i = 0; while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces i++; if (i < lengthLine) { if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') { styler.ColourTo(endPos, SCE_PROPS_COMMENT); } else if (lineBuffer[i] == '[') { styler.ColourTo(endPos, SCE_PROPS_SECTION); } else if (lineBuffer[i] == '@') { styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL); if (lineBuffer[++i] == '=') styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT); styler.ColourTo(endPos, SCE_PROPS_DEFAULT); } else { // Search for the '=' character while ((i < lengthLine) && (lineBuffer[i] != '=')) i++; if ((i < lengthLine) && (lineBuffer[i] == '=')) { styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY); styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT); styler.ColourTo(endPos, SCE_PROPS_DEFAULT); } else { styler.ColourTo(endPos, SCE_PROPS_DEFAULT); } } } else { styler.ColourTo(endPos, SCE_PROPS_DEFAULT); } } static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); unsigned int linePos = 0; unsigned int startLine = startPos; for (unsigned int i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it lineBuffer[linePos] = '\0'; ColourisePropsLine(lineBuffer, linePos, startLine, i, styler); linePos = 0; startLine = i + 1; } } if (linePos > 0) { // Last line does not have ending characters ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler); } } // adaption by ksc, using the "} else {" trick of 1.53 // 030721 static void FoldPropsDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); bool headerPoint = false; int lev; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler[i+1]; int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_PROPS_SECTION) { headerPoint = true; } if (atEOL) { lev = SC_FOLDLEVELBASE; if (lineCurrent > 0) { int levelPrevious = styler.LevelAt(lineCurrent - 1); if (levelPrevious & SC_FOLDLEVELHEADERFLAG) { lev = SC_FOLDLEVELBASE + 1; } else { lev = levelPrevious & SC_FOLDLEVELNUMBERMASK; } } if (headerPoint) { lev = SC_FOLDLEVELBASE; } if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (headerPoint) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; visibleChars = 0; headerPoint = false; } if (!isspacechar(ch)) visibleChars++; } if (lineCurrent > 0) { int levelPrevious = styler.LevelAt(lineCurrent - 1); if (levelPrevious & SC_FOLDLEVELHEADERFLAG) { lev = SC_FOLDLEVELBASE + 1; } else { lev = levelPrevious & SC_FOLDLEVELNUMBERMASK; } } else { lev = SC_FOLDLEVELBASE; } int flagsNext = styler.LevelAt(lineCurrent); styler.SetLevel(lineCurrent, lev | flagsNext & ~SC_FOLDLEVELNUMBERMASK); } static void ColouriseMakeLine( char *lineBuffer, unsigned int lengthLine, unsigned int startLine, unsigned int endPos, Accessor &styler) { unsigned int i = 0; int lastNonSpace = -1; unsigned int state = SCE_MAKE_DEFAULT; bool bSpecial = false; // check for a tab character in column 0 indicating a command bool bCommand = false; if ((lengthLine > 0) && (lineBuffer[0] == '\t')) bCommand = true; // Skip initial spaces while ((i < lengthLine) && isspacechar(lineBuffer[i])) { i++; } if (lineBuffer[i] == '#') { // Comment styler.ColourTo(endPos, SCE_MAKE_COMMENT); return; } if (lineBuffer[i] == '!') { // Special directive styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR); return; } while (i < lengthLine) { if (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(') { styler.ColourTo(startLine + i - 1, state); state = SCE_MAKE_IDENTIFIER; } else if (state == SCE_MAKE_IDENTIFIER && lineBuffer[i] == ')') { styler.ColourTo(startLine + i, state); state = SCE_MAKE_DEFAULT; } // skip identifier and target styling if this is a command line if (!bSpecial && !bCommand) { if (lineBuffer[i] == ':') { if (((i + 1) < lengthLine) && (lineBuffer[i + 1] == '=')) { // it's a ':=', so style as an identifier if (lastNonSpace >= 0) styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER); styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); styler.ColourTo(startLine + i + 1, SCE_MAKE_OPERATOR); } else { // We should check that no colouring was made since the beginning of the line, // to avoid colouring stuff like /OUT:file if (lastNonSpace >= 0) styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET); styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR); } bSpecial = true; // Only react to the first ':' of the line state = SCE_MAKE_DEFAULT; } else if (lineBuffer[i] == '=') { if (lastNonSpace >= 0) styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER); styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR); bSpecial = true; // Only react to the first '=' of the line state = SCE_MAKE_DEFAULT; } } if (!isspacechar(lineBuffer[i])) { lastNonSpace = i; } i++; } if (state == SCE_MAKE_IDENTIFIER) { styler.ColourTo(endPos, SCE_MAKE_IDEOL); // Error, variable reference not ended } else { styler.ColourTo(endPos, SCE_MAKE_DEFAULT); } } static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); unsigned int linePos = 0; unsigned int startLine = startPos; for (unsigned int i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it lineBuffer[linePos] = '\0'; ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler); linePos = 0; startLine = i + 1; } } if (linePos > 0) { // Last line does not have ending characters ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length - 1, styler); } } static bool strstart(const char *haystack, const char *needle) { return strncmp(haystack, needle, strlen(needle)) == 0; } static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine) { if (lineBuffer[0] == '>') { // Command or return status return SCE_ERR_CMD; } else if (lineBuffer[0] == '<') { // Diff removal, but not interested. Trapped to avoid hitting CTAG cases. return SCE_ERR_DEFAULT; } else if (lineBuffer[0] == '!') { return SCE_ERR_DIFF_CHANGED; } else if (lineBuffer[0] == '+') { if (strstart(lineBuffer, "+++ ")) { return SCE_ERR_DIFF_MESSAGE; } else { return SCE_ERR_DIFF_ADDITION; } } else if (lineBuffer[0] == '-') { if (strstart(lineBuffer, "--- ")) { return SCE_ERR_DIFF_MESSAGE; } else { return SCE_ERR_DIFF_DELETION; } } else if (strstart(lineBuffer, "cf90-")) { // Absoft Pro Fortran 90/95 v8.2 error and/or warning message return SCE_ERR_ABSF; } else if (strstart(lineBuffer, "fortcom:")) { // Intel Fortran Compiler v8.0 error/warning message return SCE_ERR_IFORT; } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) { return SCE_ERR_PYTHON; } else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) { return SCE_ERR_PHP; } else if ((strstart(lineBuffer, "Error ") || strstart(lineBuffer, "Warning ")) && strstr(lineBuffer, " at (") && strstr(lineBuffer, ") : ") && (strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) { // Intel Fortran Compiler error/warning message return SCE_ERR_IFC; } else if (strstart(lineBuffer, "Error ")) { // Borland error message return SCE_ERR_BORLAND; } else if (strstart(lineBuffer, "Warning ")) { // Borland warning message return SCE_ERR_BORLAND; } else if (strstr(lineBuffer, "at line " ) && (strstr(lineBuffer, "at line " ) < (lineBuffer + lengthLine)) && strstr(lineBuffer, "file ") && (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) { // Lua 4 error message return SCE_ERR_LUA; } else if (strstr(lineBuffer, " at " ) && (strstr(lineBuffer, " at " ) < (lineBuffer + lengthLine)) && strstr(lineBuffer, " line ") && (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) && (strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) { // perl error message return SCE_ERR_PERL; } else if ((memcmp(lineBuffer, " at ", 6) == 0) && strstr(lineBuffer, ":line ")) { // A .NET traceback return SCE_ERR_NET; } else if (strstart(lineBuffer, "Line ") && strstr(lineBuffer, ", file ")) { // Essential Lahey Fortran error message return SCE_ERR_ELF; } else if (strstart(lineBuffer, "line ") && strstr(lineBuffer, " column ")) { // HTML tidy style: line 42 column 1 return SCE_ERR_TIDY; } else if (strstart(lineBuffer, "\tat ") && strstr(lineBuffer, "(") && strstr(lineBuffer, ".java:")) { // Java stack back trace return SCE_ERR_JAVA_STACK; } else { // Look for one of the following formats: // GCC: :: // Microsoft: () : // Common: (): warning|error|note|remark|catastrophic|fatal // Common: () warning|error|note|remark|catastrophic|fatal // Microsoft: (,) // CTags: \t // Lua 5 traceback: \t:: bool initialTab = (lineBuffer[0] == '\t'); enum { stInitial, stGccStart, stGccDigit, stGcc, stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet, stCtagsStart, stCtagsStartString, stCtagsStringDollar, stCtags, stUnrecognized } state = stInitial; for (unsigned int i = 0; i < lengthLine; i++) { char ch = lineBuffer[i]; char chNext = ' '; if ((i + 1) < lengthLine) chNext = lineBuffer[i + 1]; if (state == stInitial) { if (ch == ':') { // May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix) if ((chNext != '\\') && (chNext != '/')) { // This check is not completely accurate as may be on // GTK+ with a file name that includes ':'. state = stGccStart; } } else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) { // May be Microsoft // Check against '0' often removes phone numbers state = stMsStart; } else if ((ch == '\t') && (!initialTab)) { // May be CTags state = stCtagsStart; } } else if (state == stGccStart) { // : state = Is1To9(ch) ? stGccDigit : stUnrecognized; } else if (state == stGccDigit) { // : if (ch == ':') { state = stGcc; // :9.*: is GCC break; } else if (!Is0To9(ch)) { state = stUnrecognized; } } else if (state == stMsStart) { // ( state = Is0To9(ch) ? stMsDigit : stUnrecognized; } else if (state == stMsDigit) { // ( if (ch == ',') { state = stMsDigitComma; } else if (ch == ')') { state = stMsBracket; } else if ((ch != ' ') && !Is0To9(ch)) { state = stUnrecognized; } } else if (state == stMsBracket) { // () if ((ch == ' ') && (chNext == ':')) { state = stMsVc; } else if ((ch == ':' && chNext == ' ') || (ch == ' ')) { // Possibly Delphi.. don't test against chNext as it's one of the strings below. char word[512]; unsigned int j, chPos; unsigned numstep; chPos = 0; if (ch == ' ') numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i. else numstep = 2; // otherwise add 2. for (j = i + numstep; j < lengthLine && isalpha(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) word[chPos++] = lineBuffer[j]; word[chPos] = 0; if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") || !CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") || !CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) { state = stMsVc; } else state = stUnrecognized; } else { state = stUnrecognized; } } else if (state == stMsDigitComma) { // (, if (ch == ')') { state = stMsDotNet; break; } else if ((ch != ' ') && !Is0To9(ch)) { state = stUnrecognized; } } else if (state == stCtagsStart) { if ((lineBuffer[i - 1] == '\t') && ((ch == '/' && lineBuffer[i + 1] == '^') || Is0To9(ch))) { state = stCtags; break; } else if ((ch == '/') && (lineBuffer[i + 1] == '^')) { state = stCtagsStartString; } } else if ((state == stCtagsStartString) && ((lineBuffer[i] == '$') && (lineBuffer[i + 1] == '/'))) { state = stCtagsStringDollar; break; } } if (state == stGcc) { return SCE_ERR_GCC; } else if ((state == stMsVc) || (state == stMsDotNet)) { return SCE_ERR_MS; } else if ((state == stCtagsStringDollar) || (state == stCtags)) { return SCE_ERR_CTAG; } else { return SCE_ERR_DEFAULT; } } } static void ColouriseErrorListLine( char *lineBuffer, unsigned int lengthLine, unsigned int endPos, Accessor &styler) { styler.ColourTo(endPos, RecogniseErrorListLine(lineBuffer, lengthLine)); } static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { char lineBuffer[10000]; styler.StartAt(startPos); styler.StartSegment(startPos); unsigned int linePos = 0; for (unsigned int i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it lineBuffer[linePos] = '\0'; ColouriseErrorListLine(lineBuffer, linePos, i, styler); linePos = 0; } } if (linePos > 0) { // Last line does not have ending characters ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler); } } static int isSpecial(char s) { return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') || (s == '\"') || (s == '`') || (s == '^') || (s == '~'); } static int isTag(int start, Accessor &styler) { char s[6]; unsigned int i = 0, e = 1; while (i < 5 && e) { s[i] = styler[start + i]; i++; e = styler[start + i] != '{'; } s[i] = '\0'; return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0); } static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { styler.StartAt(startPos); int state = initStyle; char chNext = styler[startPos]; styler.StartSegment(startPos); int lengthDoc = startPos + length; for (int i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); i++; continue; } switch (state) { case SCE_L_DEFAULT : switch (ch) { case '\\' : styler.ColourTo(i - 1, state); if (isSpecial(styler[i + 1])) { styler.ColourTo(i + 1, SCE_L_COMMAND); i++; chNext = styler.SafeGetCharAt(i + 1); } else { if (isTag(i + 1, styler)) state = SCE_L_TAG; else state = SCE_L_COMMAND; } break; case '$' : styler.ColourTo(i - 1, state); state = SCE_L_MATH; if (chNext == '$') { i++; chNext = styler.SafeGetCharAt(i + 1); } break; case '%' : styler.ColourTo(i - 1, state); state = SCE_L_COMMENT; break; } break; case SCE_L_COMMAND : if (chNext == '[' || chNext == '{' || chNext == '}' || chNext == ' ' || chNext == '\r' || chNext == '\n') { styler.ColourTo(i, state); state = SCE_L_DEFAULT; i++; chNext = styler.SafeGetCharAt(i + 1); } break; case SCE_L_TAG : if (ch == '}') { styler.ColourTo(i, state); state = SCE_L_DEFAULT; } break; case SCE_L_MATH : if (ch == '$') { if (chNext == '$') { i++; chNext = styler.SafeGetCharAt(i + 1); } styler.ColourTo(i, state); state = SCE_L_DEFAULT; } break; case SCE_L_COMMENT : if (ch == '\r' || ch == '\n') { styler.ColourTo(i - 1, state); state = SCE_L_DEFAULT; } } } styler.ColourTo(lengthDoc-1, state); } static const char * const batchWordListDesc[] = { "Internal Commands", "External Commands", 0 }; static const char * const emptyWordListDesc[] = { 0 }; static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { // Null language means all style bytes are 0 so just mark the end - no need to fill in. if (length > 0) { styler.StartAt(startPos + length - 1); styler.StartSegment(startPos + length - 1); styler.ColourTo(startPos + length - 1, 0); } } LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc); LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc); LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc); LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc); LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc); LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex", 0, emptyWordListDesc); LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null"); sqliteman-1.2.2/sqliteman/qscintilla2/src/ContractionState.h0000644000175000001440000000303611407213302023562 0ustar subzerousers// Scintilla source code edit control /** @file ContractionState.h ** Manages visibility of lines for folding. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef CONTRACTIONSTATE_H #define CONTRACTIONSTATE_H #ifdef SCI_NAMESPACE namespace Scintilla { #endif /** */ class OneLine { public: int displayLine; ///< Position within set of visible lines //int docLine; ///< Inverse of @a displayLine int height; ///< Number of display lines needed to show all of the line bool visible; bool expanded; OneLine(); virtual ~OneLine() {} }; /** */ class ContractionState { void Grow(int sizeNew); enum { growSize = 4000 }; int linesInDoc; mutable int linesInDisplay; mutable OneLine *lines; int size; mutable int *docLines; mutable int sizeDocLines; mutable bool valid; void MakeValid() const; public: ContractionState(); virtual ~ContractionState(); void Clear(); int LinesInDoc() const; int LinesDisplayed() const; int DisplayFromDoc(int lineDoc) const; int DocFromDisplay(int lineDisplay) const; void InsertLines(int lineDoc, int lineCount); void DeleteLines(int lineDoc, int lineCount); bool GetVisible(int lineDoc) const; bool SetVisible(int lineDocStart, int lineDocEnd, bool visible); bool GetExpanded(int lineDoc) const; bool SetExpanded(int lineDoc, bool expanded); int GetHeight(int lineDoc) const; bool SetHeight(int lineDoc, int height); void ShowAll(); }; #ifdef SCI_NAMESPACE } #endif #endif sqliteman-1.2.2/sqliteman/qscintilla2/src/LexPLM.cpp0000644000175000001440000001260511407213302021734 0ustar subzerousers// Copyright (c) 1990-2007, Scientific Toolworks, Inc. // Author: Jason Haslam // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #include "StyleContext.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static void GetRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) { unsigned int i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast(tolower(styler[start + i])); i++; } s[i] = '\0'; } static void ColourisePlmDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { unsigned int endPos = startPos + length; int state = initStyle; styler.StartAt(startPos); styler.StartSegment(startPos); for (unsigned int i = startPos; i < endPos; i++) { char ch = styler.SafeGetCharAt(i); char chNext = styler.SafeGetCharAt(i + 1); if (state == SCE_PLM_DEFAULT) { if (ch == '/' && chNext == '*') { styler.ColourTo(i - 1, state); state = SCE_PLM_COMMENT; } else if (ch == '\'') { styler.ColourTo(i - 1, state); state = SCE_PLM_STRING; } else if (isdigit(ch)) { styler.ColourTo(i - 1, state); state = SCE_PLM_NUMBER; } else if (isalpha(ch)) { styler.ColourTo(i - 1, state); state = SCE_PLM_IDENTIFIER; } else if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '=' || ch == '<' || ch == '>' || ch == ':') { styler.ColourTo(i - 1, state); state = SCE_PLM_OPERATOR; } else if (ch == '$') { styler.ColourTo(i - 1, state); state = SCE_PLM_CONTROL; } } else if (state == SCE_PLM_COMMENT) { if (ch == '*' && chNext == '/') { i++; styler.ColourTo(i, state); state = SCE_PLM_DEFAULT; } } else if (state == SCE_PLM_STRING) { if (ch == '\'') { if (chNext == '\'') { i++; } else { styler.ColourTo(i, state); state = SCE_PLM_DEFAULT; } } } else if (state == SCE_PLM_NUMBER) { if (!isdigit(ch) && !isalpha(ch) && ch != '$') { i--; styler.ColourTo(i, state); state = SCE_PLM_DEFAULT; } } else if (state == SCE_PLM_IDENTIFIER) { if (!isdigit(ch) && !isalpha(ch) && ch != '$') { // Get the entire identifier. char word[1024]; int segmentStart = styler.GetStartSegment(); GetRange(segmentStart, i - 1, styler, word, sizeof(word)); i--; if (keywordlists[0]->InList(word)) styler.ColourTo(i, SCE_PLM_KEYWORD); else styler.ColourTo(i, state); state = SCE_PLM_DEFAULT; } } else if (state == SCE_PLM_OPERATOR) { if (ch != '=' && ch != '>') { i--; styler.ColourTo(i, state); state = SCE_PLM_DEFAULT; } } else if (state == SCE_PLM_CONTROL) { if (ch == '\r' || ch == '\n') { styler.ColourTo(i - 1, state); state = SCE_PLM_DEFAULT; } } } styler.ColourTo(endPos - 1, state); } static void FoldPlmDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; int startKeyword = 0; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (stylePrev != SCE_PLM_KEYWORD && style == SCE_PLM_KEYWORD) startKeyword = i; if (style == SCE_PLM_KEYWORD && styleNext != SCE_PLM_KEYWORD) { char word[1024]; GetRange(startKeyword, i, styler, word, sizeof(word)); if (strcmp(word, "procedure") == 0 || strcmp(word, "do") == 0) levelCurrent++; else if (strcmp(word, "end") == 0) levelCurrent--; } if (foldComment) { if (stylePrev != SCE_PLM_COMMENT && style == SCE_PLM_COMMENT) levelCurrent++; else if (stylePrev == SCE_PLM_COMMENT && style != SCE_PLM_COMMENT) levelCurrent--; } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char *const plmWordListDesc[] = { "Keywords", 0 }; LexerModule lmPLM(SCLEX_PLM, ColourisePlmDoc, "PL/M", FoldPlmDoc, plmWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/LexYAML.cpp0000644000175000001440000002432011407213302022043 0ustar subzerousers// Scintilla source code edit control /** @file LexYAML.cxx ** Lexer for YAML. **/ // Copyright 2003- by Sean O'Dell // Release under the same license as Scintilla/SciTE. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static const char * const yamlWordListDesc[] = { "Keywords", 0 }; static inline bool AtEOL(Accessor &styler, unsigned int i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } static unsigned int SpaceCount(char* lineBuffer) { if (lineBuffer == NULL) return 0; char* headBuffer = lineBuffer; while (*headBuffer == ' ') headBuffer++; return headBuffer - lineBuffer; } #define YAML_STATE_BITSIZE 16 #define YAML_STATE_MASK (0xFFFF0000) #define YAML_STATE_DOCUMENT (1 << YAML_STATE_BITSIZE) #define YAML_STATE_VALUE (2 << YAML_STATE_BITSIZE) #define YAML_STATE_COMMENT (3 << YAML_STATE_BITSIZE) #define YAML_STATE_TEXT_PARENT (4 << YAML_STATE_BITSIZE) #define YAML_STATE_TEXT (5 << YAML_STATE_BITSIZE) static void ColouriseYAMLLine( char *lineBuffer, unsigned int currentLine, unsigned int lengthLine, unsigned int startLine, unsigned int endPos, WordList &keywords, Accessor &styler) { unsigned int i = 0; bool bInQuotes = false; unsigned int indentAmount = SpaceCount(lineBuffer); if (currentLine > 0) { int parentLineState = styler.GetLineState(currentLine - 1); if ((parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT || (parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT_PARENT) { unsigned int parentIndentAmount = parentLineState&(~YAML_STATE_MASK); if (indentAmount > parentIndentAmount) { styler.SetLineState(currentLine, YAML_STATE_TEXT | parentIndentAmount); styler.ColourTo(endPos, SCE_YAML_TEXT); return; } } } styler.SetLineState(currentLine, 0); if (strncmp(lineBuffer, "---", 3) == 0) { // Document marker styler.SetLineState(currentLine, YAML_STATE_DOCUMENT); styler.ColourTo(endPos, SCE_YAML_DOCUMENT); return; } // Skip initial spaces while ((i < lengthLine) && lineBuffer[i] == ' ') { // YAML always uses space, never TABS or anything else i++; } if (lineBuffer[i] == '\t') { // if we skipped all spaces, and we are NOT inside a text block, this is wrong styler.ColourTo(endPos, SCE_YAML_ERROR); return; } if (lineBuffer[i] == '#') { // Comment styler.SetLineState(currentLine, YAML_STATE_COMMENT); styler.ColourTo(endPos, SCE_YAML_COMMENT); return; } while (i < lengthLine) { if (lineBuffer[i] == '\'' || lineBuffer[i] == '\"') { bInQuotes = !bInQuotes; } else if (lineBuffer[i] == ':' && !bInQuotes) { styler.ColourTo(startLine + i, SCE_YAML_IDENTIFIER); // Non-folding scalar i++; while ((i < lengthLine) && isspacechar(lineBuffer[i])) i++; unsigned int endValue = lengthLine - 1; while ((endValue >= i) && isspacechar(lineBuffer[endValue])) endValue--; lineBuffer[endValue + 1] = '\0'; if (lineBuffer[i] == '|' || lineBuffer[i] == '>') { i++; if (lineBuffer[i] == '+' || lineBuffer[i] == '-') i++; while ((i < lengthLine) && isspacechar(lineBuffer[i])) i++; if (lineBuffer[i] == '\0') { styler.SetLineState(currentLine, YAML_STATE_TEXT_PARENT | indentAmount); styler.ColourTo(endPos, SCE_YAML_DEFAULT); return; } else if (lineBuffer[i] == '#') { styler.SetLineState(currentLine, YAML_STATE_TEXT_PARENT | indentAmount); styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT); styler.ColourTo(endPos, SCE_YAML_COMMENT); return; } else { styler.ColourTo(endPos, SCE_YAML_ERROR); return; } } styler.SetLineState(currentLine, YAML_STATE_VALUE); if (lineBuffer[i] == '&' || lineBuffer[i] == '*') { styler.ColourTo(endPos, SCE_YAML_REFERENCE); return; } if (keywords.InList(&lineBuffer[i])) { // Convertible value (true/false, etc.) styler.ColourTo(endPos, SCE_YAML_KEYWORD); return; } else { unsigned int i2 = i; while ((i < lengthLine) && lineBuffer[i]) { if (!isdigit(lineBuffer[i]) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') { styler.ColourTo(endPos, SCE_YAML_DEFAULT); return; } i++; } if (i > i2) { styler.ColourTo(endPos, SCE_YAML_NUMBER); return; } } break; // shouldn't get here, but just in case, the rest of the line is coloured the default } i++; } styler.ColourTo(endPos, SCE_YAML_DEFAULT); } static void ColouriseYAMLDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) { char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); unsigned int linePos = 0; unsigned int startLine = startPos; unsigned int endPos = startPos + length; unsigned int maxPos = styler.Length(); unsigned int lineCurrent = styler.GetLine(startPos); for (unsigned int i = startPos; i < maxPos && i < endPos; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { // End of line (or of line buffer) met, colourise it lineBuffer[linePos] = '\0'; ColouriseYAMLLine(lineBuffer, lineCurrent, linePos, startLine, i, *keywordLists[0], styler); linePos = 0; startLine = i + 1; lineCurrent++; } } if (linePos > 0) { // Last line does not have ending characters ColouriseYAMLLine(lineBuffer, lineCurrent, linePos, startLine, startPos + length - 1, *keywordLists[0], styler); } } static bool IsCommentLine(int line, Accessor &styler) { int pos = styler.LineStart(line); if (styler[pos] == '#') return true; return false; } static void FoldYAMLDoc(unsigned int startPos, int length, int /*initStyle - unused*/, WordList *[], Accessor &styler) { const int maxPos = startPos + length; const int maxLines = styler.GetLine(maxPos - 1); // Requested last line const int docLines = styler.GetLine(styler.Length() - 1); // Available last line const bool foldComment = styler.GetPropertyInt("fold.comment.yaml") != 0; // Backtrack to previous non-blank line so we can determine indent level // for any white space lines // and so we can fix any preceding fold level (which is why we go back // at least one line in all cases) int spaceFlags = 0; int lineCurrent = styler.GetLine(startPos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); while (lineCurrent > 0) { lineCurrent--; indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) && (!IsCommentLine(lineCurrent, styler))) break; } int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; // Set up initial loop state int prevComment = 0; if (lineCurrent >= 1) prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler); // Process all characters to end of requested range // or comment that hangs over the end of the range. Cap processing in all cases // to end of document (in case of unclosed comment at end). while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || prevComment)) { // Gather info int lev = indentCurrent; int lineNext = lineCurrent + 1; int indentNext = indentCurrent; if (lineNext <= docLines) { // Information about next line is only available if not at end of document indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); } const int comment = foldComment && IsCommentLine(lineCurrent, styler); const int comment_start = (comment && !prevComment && (lineNext <= docLines) && IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE)); const int comment_continue = (comment && prevComment); if (!comment) indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; if (indentNext & SC_FOLDLEVELWHITEFLAG) indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel; if (comment_start) { // Place fold point at start of a block of comments lev |= SC_FOLDLEVELHEADERFLAG; } else if (comment_continue) { // Add level to rest of lines in the block lev = lev + 1; } // Skip past any blank lines for next indent level info; we skip also // comments (all comments, not just those starting in column 0) // which effectively folds them into surrounding code rather // than screwing up folding. while ((lineNext < docLines) && ((indentNext & SC_FOLDLEVELWHITEFLAG) || (lineNext <= docLines && IsCommentLine(lineNext, styler)))) { lineNext++; indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); } const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK; const int levelBeforeComments = Platform::Maximum(indentCurrentLevel,levelAfterComments); // Now set all the indent levels on the lines we skipped // Do this from end to start. Once we encounter one line // which is indented more than the line after the end of // the comment-block, use the level of the block before int skipLine = lineNext; int skipLevel = levelAfterComments; while (--skipLine > lineCurrent) { int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL); if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) skipLevel = levelBeforeComments; int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; styler.SetLevel(skipLine, skipLevel | whiteFlag); } // Set fold header on non-comment line if (!comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) { if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) lev |= SC_FOLDLEVELHEADERFLAG; } // Keep track of block comment state of previous line prevComment = comment_start || comment_continue; // Set fold level for this line and move to next line styler.SetLevel(lineCurrent, lev); indentCurrent = indentNext; lineCurrent = lineNext; } // NOTE: Cannot set level of last line here because indentCurrent doesn't have // header flag set; the loop above is crafted to take care of this case! //styler.SetLevel(lineCurrent, indentCurrent); } LexerModule lmYAML(SCLEX_YAML, ColouriseYAMLDoc, "yaml", FoldYAMLDoc, yamlWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/Document.cpp0000644000175000001440000012105611407213302022412 0ustar subzerousers// Scintilla source code edit control /** @file Document.cxx ** Text document that handles notifications, DBCS, styling, words and end of line. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include "Platform.h" #include "Scintilla.h" #include "SVector.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" #include "CellBuffer.h" #include "CharClassify.h" #include "Decoration.h" #include "Document.h" #include "RESearch.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif // This is ASCII specific but is safe with chars >= 0x80 static inline bool isspacechar(unsigned char ch) { return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); } static inline bool IsPunctuation(char ch) { return isascii(ch) && ispunct(ch); } static inline bool IsADigit(char ch) { return isascii(ch) && isdigit(ch); } static inline bool IsLowerCase(char ch) { return isascii(ch) && islower(ch); } static inline bool IsUpperCase(char ch) { return isascii(ch) && isupper(ch); } Document::Document() { refCount = 0; #ifdef unix eolMode = SC_EOL_LF; #else eolMode = SC_EOL_CRLF; #endif dbcsCodePage = 0; stylingBits = 5; stylingBitsMask = 0x1F; stylingMask = 0; endStyled = 0; styleClock = 0; enteredModification = 0; enteredStyling = 0; enteredReadOnlyCount = 0; tabInChars = 8; indentInChars = 0; actualIndentInChars = 8; useTabs = true; tabIndents = true; backspaceUnindents = false; watchers = 0; lenWatchers = 0; matchesValid = false; pre = 0; substituted = 0; } Document::~Document() { for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifyDeleted(this, watchers[i].userData); } delete []watchers; watchers = 0; lenWatchers = 0; delete pre; pre = 0; delete []substituted; substituted = 0; } // Increase reference count and return its previous value. int Document::AddRef() { return refCount++; } // Decrease reference count and return its previous value. // Delete the document if reference count reaches zero. int Document::Release() { int curRefCount = --refCount; if (curRefCount == 0) delete this; return curRefCount; } void Document::SetSavePoint() { cb.SetSavePoint(); NotifySavePoint(true); } int Document::AddMark(int line, int markerNum) { int prev = cb.AddMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); mh.line = line; NotifyModified(mh); return prev; } void Document::AddMarkSet(int line, int valueSet) { unsigned int m = valueSet; for (int i = 0; m; i++, m >>= 1) if (m & 1) cb.AddMark(line, i); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); mh.line = line; NotifyModified(mh); } void Document::DeleteMark(int line, int markerNum) { cb.DeleteMark(line, markerNum); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); mh.line = line; NotifyModified(mh); } void Document::DeleteMarkFromHandle(int markerHandle) { cb.DeleteMarkFromHandle(markerHandle); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); mh.line = -1; NotifyModified(mh); } void Document::DeleteAllMarks(int markerNum) { cb.DeleteAllMarks(markerNum); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); mh.line = -1; NotifyModified(mh); } int Document::LineStart(int line) { return cb.LineStart(line); } int Document::LineEnd(int line) { if (line == LinesTotal() - 1) { return LineStart(line + 1); } else { int position = LineStart(line + 1) - 1; // When line terminator is CR+LF, may need to go back one more if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { position--; } return position; } } int Document::LineFromPosition(int pos) { return cb.LineFromPosition(pos); } int Document::LineEndPosition(int position) { return LineEnd(LineFromPosition(position)); } int Document::VCHomePosition(int position) { int line = LineFromPosition(position); int startPosition = LineStart(line); int endLine = LineStart(line + 1) - 1; int startText = startPosition; while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) ) startText++; if (position == startText) return startPosition; else return startText; } int Document::SetLevel(int line, int level) { int prev = cb.SetLevel(line, level); if (prev != level) { DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0); mh.line = line; mh.foldLevelNow = level; mh.foldLevelPrev = prev; NotifyModified(mh); } return prev; } static bool IsSubordinate(int levelStart, int levelTry) { if (levelTry & SC_FOLDLEVELWHITEFLAG) return true; else return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK); } int Document::GetLastChild(int lineParent, int level) { if (level == -1) level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK; int maxLine = LinesTotal(); int lineMaxSubord = lineParent; while (lineMaxSubord < maxLine - 1) { EnsureStyledTo(LineStart(lineMaxSubord + 2)); if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1))) break; lineMaxSubord++; } if (lineMaxSubord > lineParent) { if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) { // Have chewed up some whitespace that belongs to a parent so seek back if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) { lineMaxSubord--; } } } return lineMaxSubord; } int Document::GetFoldParent(int line) { int level = GetLevel(line) & SC_FOLDLEVELNUMBERMASK; int lineLook = line - 1; while ((lineLook > 0) && ( (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level)) ) { lineLook--; } if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) && ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) { return lineLook; } else { return -1; } } int Document::ClampPositionIntoDocument(int pos) { return Platform::Clamp(pos, 0, Length()); } bool Document::IsCrLf(int pos) { if (pos < 0) return false; if (pos >= (Length() - 1)) return false; return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n'); } static const int maxBytesInDBCSCharacter=5; int Document::LenChar(int pos) { if (pos < 0) { return 1; } else if (IsCrLf(pos)) { return 2; } else if (SC_CP_UTF8 == dbcsCodePage) { unsigned char ch = static_cast(cb.CharAt(pos)); if (ch < 0x80) return 1; int len = 2; if (ch >= (0x80 + 0x40 + 0x20 + 0x10)) len = 4; else if (ch >= (0x80 + 0x40 + 0x20)) len = 3; int lengthDoc = Length(); if ((pos + len) > lengthDoc) return lengthDoc -pos; else return len; } else if (dbcsCodePage) { char mbstr[maxBytesInDBCSCharacter+1]; int i; for (i=0; i= Length()) return Length(); // PLATFORM_ASSERT(pos > 0 && pos < Length()); if (checkLineEnd && IsCrLf(pos - 1)) { if (moveDir > 0) return pos + 1; else return pos - 1; } // Not between CR and LF if (dbcsCodePage) { if (SC_CP_UTF8 == dbcsCodePage) { unsigned char ch = static_cast(cb.CharAt(pos)); while ((pos > 0) && (pos < Length()) && (ch >= 0x80) && (ch < (0x80 + 0x40))) { // ch is a trail byte if (moveDir > 0) pos++; else pos--; ch = static_cast(cb.CharAt(pos)); } } else { // Anchor DBCS calculations at start of line because start of line can // not be a DBCS trail byte. int posCheck = LineStart(LineFromPosition(pos)); while (posCheck < pos) { char mbstr[maxBytesInDBCSCharacter+1]; int i; for(i=0;i pos) { if (moveDir > 0) { return posCheck + mbsize; } else { return posCheck; } } posCheck += mbsize; } } } return pos; } void Document::ModifiedAt(int pos) { if (endStyled > pos) endStyled = pos; } void Document::CheckReadOnly() { if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { enteredReadOnlyCount++; NotifyModifyAttempt(); enteredReadOnlyCount--; } } // Document only modified by gateways DeleteChars, InsertString, Undo, Redo, and SetStyleAt. // SetStyleAt does not change the persistent state of a document bool Document::DeleteChars(int pos, int len) { if (len == 0) return false; if ((pos + len) > Length()) return false; CheckReadOnly(); if (enteredModification != 0) { return false; } else { enteredModification++; if (!cb.IsReadOnly()) { NotifyModified( DocModification( SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, pos, len, 0, 0)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); bool startSequence = false; const char *text = cb.DeleteChars(pos, len, startSequence); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); if ((pos < Length()) || (pos == 0)) ModifiedAt(pos); else ModifiedAt(pos-1); NotifyModified( DocModification( SC_MOD_DELETETEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), pos, len, LinesTotal() - prevLinesTotal, text)); } enteredModification--; } return !cb.IsReadOnly(); } /** * Insert a string with a length. */ bool Document::InsertString(int position, const char *s, int insertLength) { if (insertLength <= 0) { return false; } CheckReadOnly(); if (enteredModification != 0) { return false; } else { enteredModification++; if (!cb.IsReadOnly()) { NotifyModified( DocModification( SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, position, insertLength, 0, s)); int prevLinesTotal = LinesTotal(); bool startSavePoint = cb.IsSavePoint(); bool startSequence = false; const char *text = cb.InsertString(position, s, insertLength, startSequence); if (startSavePoint && cb.IsCollectingUndo()) NotifySavePoint(!startSavePoint); ModifiedAt(position); NotifyModified( DocModification( SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), position, insertLength, LinesTotal() - prevLinesTotal, text)); } enteredModification--; } return !cb.IsReadOnly(); } int Document::Undo() { int newPos = -1; CheckReadOnly(); if (enteredModification == 0) { enteredModification++; if (!cb.IsReadOnly()) { bool startSavePoint = cb.IsSavePoint(); bool multiLine = false; int steps = cb.StartUndo(); //Platform::DebugPrintf("Steps=%d\n", steps); for (int step = 0; step < steps; step++) { const int prevLinesTotal = LinesTotal(); const Action &action = cb.GetUndoStep(); if (action.at == removeAction) { NotifyModified(DocModification( SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); } else { NotifyModified(DocModification( SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); } cb.PerformUndoStep(); int cellPosition = action.position; ModifiedAt(cellPosition); newPos = cellPosition; int modFlags = SC_PERFORMED_UNDO; // With undo, an insertion action becomes a deletion notification if (action.at == removeAction) { newPos += action.lenData; modFlags |= SC_MOD_INSERTTEXT; } else { modFlags |= SC_MOD_DELETETEXT; } if (steps > 1) modFlags |= SC_MULTISTEPUNDOREDO; const int linesAdded = LinesTotal() - prevLinesTotal; if (linesAdded != 0) multiLine = true; if (step == steps - 1) { modFlags |= SC_LASTSTEPINUNDOREDO; if (multiLine) modFlags |= SC_MULTILINEUNDOREDO; } NotifyModified(DocModification(modFlags, cellPosition, action.lenData, linesAdded, action.data)); } bool endSavePoint = cb.IsSavePoint(); if (startSavePoint != endSavePoint) NotifySavePoint(endSavePoint); } enteredModification--; } return newPos; } int Document::Redo() { int newPos = -1; CheckReadOnly(); if (enteredModification == 0) { enteredModification++; if (!cb.IsReadOnly()) { bool startSavePoint = cb.IsSavePoint(); bool multiLine = false; int steps = cb.StartRedo(); for (int step = 0; step < steps; step++) { const int prevLinesTotal = LinesTotal(); const Action &action = cb.GetRedoStep(); if (action.at == insertAction) { NotifyModified(DocModification( SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); } else { NotifyModified(DocModification( SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); } cb.PerformRedoStep(); ModifiedAt(action.position); newPos = action.position; int modFlags = SC_PERFORMED_REDO; if (action.at == insertAction) { newPos += action.lenData; modFlags |= SC_MOD_INSERTTEXT; } else { modFlags |= SC_MOD_DELETETEXT; } if (steps > 1) modFlags |= SC_MULTISTEPUNDOREDO; const int linesAdded = LinesTotal() - prevLinesTotal; if (linesAdded != 0) multiLine = true; if (step == steps - 1) { modFlags |= SC_LASTSTEPINUNDOREDO; if (multiLine) modFlags |= SC_MULTILINEUNDOREDO; } NotifyModified( DocModification(modFlags, action.position, action.lenData, linesAdded, action.data)); } bool endSavePoint = cb.IsSavePoint(); if (startSavePoint != endSavePoint) NotifySavePoint(endSavePoint); } enteredModification--; } return newPos; } /** * Insert a single character. */ bool Document::InsertChar(int pos, char ch) { char chs[1]; chs[0] = ch; return InsertString(pos, chs, 1); } /** * Insert a null terminated string. */ bool Document::InsertCString(int position, const char *s) { return InsertString(position, s, strlen(s)); } void Document::ChangeChar(int pos, char ch) { DeleteChars(pos, 1); InsertChar(pos, ch); } void Document::DelChar(int pos) { DeleteChars(pos, LenChar(pos)); } void Document::DelCharBack(int pos) { if (pos <= 0) { return; } else if (IsCrLf(pos - 2)) { DeleteChars(pos - 2, 2); } else if (dbcsCodePage) { int startChar = MovePositionOutsideChar(pos - 1, -1, false); DeleteChars(startChar, pos - startChar); } else { DeleteChars(pos - 1, 1); } } static bool isindentchar(char ch) { return (ch == ' ') || (ch == '\t'); } static int NextTab(int pos, int tabSize) { return ((pos / tabSize) + 1) * tabSize; } static void CreateIndentation(char *linebuf, int length, int indent, int tabSize, bool insertSpaces) { length--; // ensure space for \0 if (!insertSpaces) { while ((indent >= tabSize) && (length > 0)) { *linebuf++ = '\t'; indent -= tabSize; length--; } } while ((indent > 0) && (length > 0)) { *linebuf++ = ' '; indent--; length--; } *linebuf = '\0'; } int Document::GetLineIndentation(int line) { int indent = 0; if ((line >= 0) && (line < LinesTotal())) { int lineStart = LineStart(line); int length = Length(); for (int i = lineStart;i < length;i++) { char ch = cb.CharAt(i); if (ch == ' ') indent++; else if (ch == '\t') indent = NextTab(indent, tabInChars); else return indent; } } return indent; } void Document::SetLineIndentation(int line, int indent) { int indentOfLine = GetLineIndentation(line); if (indent < 0) indent = 0; if (indent != indentOfLine) { char linebuf[1000]; CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs); int thisLineStart = LineStart(line); int indentPos = GetLineIndentPosition(line); BeginUndoAction(); DeleteChars(thisLineStart, indentPos - thisLineStart); InsertCString(thisLineStart, linebuf); EndUndoAction(); } } int Document::GetLineIndentPosition(int line) { if (line < 0) return 0; int pos = LineStart(line); int length = Length(); while ((pos < length) && isindentchar(cb.CharAt(pos))) { pos++; } return pos; } int Document::GetColumn(int pos) { int column = 0; int line = LineFromPosition(pos); if ((line >= 0) && (line < LinesTotal())) { for (int i = LineStart(line);i < pos;) { char ch = cb.CharAt(i); if (ch == '\t') { column = NextTab(column, tabInChars); i++; } else if (ch == '\r') { return column; } else if (ch == '\n') { return column; } else if (i >= Length()) { return column; } else { column++; i = MovePositionOutsideChar(i + 1, 1, false); } } } return column; } int Document::FindColumn(int line, int column) { int position = LineStart(line); int columnCurrent = 0; if ((line >= 0) && (line < LinesTotal())) { while ((columnCurrent < column) && (position < Length())) { char ch = cb.CharAt(position); if (ch == '\t') { columnCurrent = NextTab(columnCurrent, tabInChars); position++; } else if (ch == '\r') { return position; } else if (ch == '\n') { return position; } else { columnCurrent++; position = MovePositionOutsideChar(position + 1, 1, false); } } } return position; } void Document::Indent(bool forwards, int lineBottom, int lineTop) { // Dedent - suck white space off the front of the line to dedent by equivalent of a tab for (int line = lineBottom; line >= lineTop; line--) { int indentOfLine = GetLineIndentation(line); if (forwards) { if (LineStart(line) < LineEnd(line)) { SetLineIndentation(line, indentOfLine + IndentSize()); } } else { SetLineIndentation(line, indentOfLine - IndentSize()); } } } // Convert line endings for a piece of text to a particular mode. // Stop at len or when a NUL is found. // Caller must delete the returned pointer. char *Document::TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolMode) { char *dest = new char[2 * len + 1]; const char *sptr = s; char *dptr = dest; for (size_t i = 0; (i < len) && (*sptr != '\0'); i++) { if (*sptr == '\n' || *sptr == '\r') { if (eolMode == SC_EOL_CR) { *dptr++ = '\r'; } else if (eolMode == SC_EOL_LF) { *dptr++ = '\n'; } else { // eolMode == SC_EOL_CRLF *dptr++ = '\r'; *dptr++ = '\n'; } if ((*sptr == '\r') && (i+1 < len) && (*(sptr+1) == '\n')) { i++; sptr++; } sptr++; } else { *dptr++ = *sptr++; } } *dptr++ = '\0'; *pLenOut = (dptr - dest) - 1; return dest; } void Document::ConvertLineEnds(int eolModeSet) { BeginUndoAction(); for (int pos = 0; pos < Length(); pos++) { if (cb.CharAt(pos) == '\r') { if (cb.CharAt(pos + 1) == '\n') { // CRLF if (eolModeSet == SC_EOL_CR) { DeleteChars(pos + 1, 1); // Delete the LF } else if (eolModeSet == SC_EOL_LF) { DeleteChars(pos, 1); // Delete the CR } else { pos++; } } else { // CR if (eolModeSet == SC_EOL_CRLF) { InsertString(pos + 1, "\n", 1); // Insert LF pos++; } else if (eolModeSet == SC_EOL_LF) { InsertString(pos, "\n", 1); // Insert LF DeleteChars(pos + 1, 1); // Delete CR } } } else if (cb.CharAt(pos) == '\n') { // LF if (eolModeSet == SC_EOL_CRLF) { InsertString(pos, "\r", 1); // Insert CR pos++; } else if (eolModeSet == SC_EOL_CR) { InsertString(pos, "\r", 1); // Insert CR DeleteChars(pos + 1, 1); // Delete LF } } } EndUndoAction(); } bool Document::IsWhiteLine(int line) { int currentChar = LineStart(line); int endLine = LineEnd(line); while (currentChar < endLine) { if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') { return false; } ++currentChar; } return true; } int Document::ParaUp(int pos) { int line = LineFromPosition(pos); line--; while (line >= 0 && IsWhiteLine(line)) { // skip empty lines line--; } while (line >= 0 && !IsWhiteLine(line)) { // skip non-empty lines line--; } line++; return LineStart(line); } int Document::ParaDown(int pos) { int line = LineFromPosition(pos); while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines line++; } while (line < LinesTotal() && IsWhiteLine(line)) { // skip empty lines line++; } if (line < LinesTotal()) return LineStart(line); else // end of a document return LineEnd(line-1); } CharClassify::cc Document::WordCharClass(unsigned char ch) { if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80)) return CharClassify::ccWord; return charClass.GetClass(ch); } /** * Used by commmands that want to select whole words. * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. */ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { CharClassify::cc ccStart = CharClassify::ccWord; if (delta < 0) { if (!onlyWordCharacters) ccStart = WordCharClass(cb.CharAt(pos-1)); while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) pos--; } else { if (!onlyWordCharacters && pos < Length()) ccStart = WordCharClass(cb.CharAt(pos)); while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) pos++; } return MovePositionOutsideChar(pos, delta); } /** * Find the start of the next word in either a forward (delta >= 0) or backwards direction * (delta < 0). * This is looking for a transition between character classes although there is also some * additional movement to transit white space. * Used by cursor movement by word commands. */ int Document::NextWordStart(int pos, int delta) { if (delta < 0) { while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace)) pos--; if (pos > 0) { CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) { pos--; } } } else { CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) pos++; while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace)) pos++; } return pos; } /** * Find the end of the next word in either a forward (delta >= 0) or backwards direction * (delta < 0). * This is looking for a transition between character classes although there is also some * additional movement to transit white space. * Used by cursor movement by word commands. */ int Document::NextWordEnd(int pos, int delta) { if (delta < 0) { if (pos > 0) { CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); if (ccStart != CharClassify::ccSpace) { while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) { pos--; } } while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) { pos--; } } } else { while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) { pos++; } if (pos < Length()) { CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) { pos++; } } } return pos; } /** * Check that the character at the given position is a word or punctuation character and that * the previous character is of a different character class. */ bool Document::IsWordStartAt(int pos) { if (pos > 0) { CharClassify::cc ccPos = WordCharClass(CharAt(pos)); return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) && (ccPos != WordCharClass(CharAt(pos - 1))); } return true; } /** * Check that the character at the given position is a word or punctuation character and that * the next character is of a different character class. */ bool Document::IsWordEndAt(int pos) { if (pos < Length()) { CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1)); return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) && (ccPrev != WordCharClass(CharAt(pos))); } return true; } /** * Check that the given range is has transitions between character classes at both * ends and where the characters on the inside are word or punctuation characters. */ bool Document::IsWordAt(int start, int end) { return IsWordStartAt(start) && IsWordEndAt(end); } // The comparison and case changing functions here assume ASCII // or extended ASCII such as the normal Windows code page. static inline char MakeUpperCase(char ch) { if (ch < 'a' || ch > 'z') return ch; else return static_cast(ch - 'a' + 'A'); } static inline char MakeLowerCase(char ch) { if (ch < 'A' || ch > 'Z') return ch; else return static_cast(ch - 'A' + 'a'); } // Define a way for the Regular Expression code to access the document class DocumentIndexer : public CharacterIndexer { Document *pdoc; int end; public: DocumentIndexer(Document *pdoc_, int end_) : pdoc(pdoc_), end(end_) { } virtual ~DocumentIndexer() { } virtual char CharAt(int index) { if (index < 0 || index >= end) return 0; else return pdoc->CharAt(index); } }; /** * Find text in document, supporting both forward and backward * searches (just pass minPos > maxPos to do a backward search) * Has not been tested with backwards DBCS searches yet. */ long Document::FindText(int minPos, int maxPos, const char *s, bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length) { if (regExp) { if (!pre) pre = new RESearch(&charClass); if (!pre) return -1; int increment = (minPos <= maxPos) ? 1 : -1; int startPos = minPos; int endPos = maxPos; // Range endpoints should not be inside DBCS characters, but just in case, move them. startPos = MovePositionOutsideChar(startPos, 1, false); endPos = MovePositionOutsideChar(endPos, 1, false); const char *errmsg = pre->Compile(s, *length, caseSensitive, posix); if (errmsg) { return -1; } // Find a variable in a property file: \$(\([A-Za-z0-9_.]+\)) // Replace first '.' with '-' in each property file variable reference: // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\)) // Replace: $(\1-\2) int lineRangeStart = LineFromPosition(startPos); int lineRangeEnd = LineFromPosition(endPos); if ((increment == 1) && (startPos >= LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd)) { // the start position is at end of line or between line end characters. lineRangeStart++; startPos = LineStart(lineRangeStart); } int pos = -1; int lenRet = 0; char searchEnd = s[*length - 1]; int lineRangeBreak = lineRangeEnd + increment; for (int line = lineRangeStart; line != lineRangeBreak; line += increment) { int startOfLine = LineStart(line); int endOfLine = LineEnd(line); if (increment == 1) { if (line == lineRangeStart) { if ((startPos != startOfLine) && (s[0] == '^')) continue; // Can't match start of line if start position after start of line startOfLine = startPos; } if (line == lineRangeEnd) { if ((endPos != endOfLine) && (searchEnd == '$')) continue; // Can't match end of line if end position before end of line endOfLine = endPos; } } else { if (line == lineRangeEnd) { if ((endPos != startOfLine) && (s[0] == '^')) continue; // Can't match start of line if end position after start of line startOfLine = endPos; } if (line == lineRangeStart) { if ((startPos != endOfLine) && (searchEnd == '$')) continue; // Can't match end of line if start position before end of line endOfLine = startPos; } } DocumentIndexer di(this, endOfLine); int success = pre->Execute(di, startOfLine, endOfLine); if (success) { pos = pre->bopat[0]; lenRet = pre->eopat[0] - pre->bopat[0]; if (increment == -1) { // Check for the last match on this line. int repetitions = 1000; // Break out of infinite loop while (success && (pre->eopat[0] <= endOfLine) && (repetitions--)) { success = pre->Execute(di, pos+1, endOfLine); if (success) { if (pre->eopat[0] <= minPos) { pos = pre->bopat[0]; lenRet = pre->eopat[0] - pre->bopat[0]; } else { success = 0; } } } } break; } } *length = lenRet; return pos; } else { bool forward = minPos <= maxPos; int increment = forward ? 1 : -1; // Range endpoints should not be inside DBCS characters, but just in case, move them. int startPos = MovePositionOutsideChar(minPos, increment, false); int endPos = MovePositionOutsideChar(maxPos, increment, false); // Compute actual search ranges needed int lengthFind = *length; if (lengthFind == -1) lengthFind = static_cast(strlen(s)); int endSearch = endPos; if (startPos <= endPos) { endSearch = endPos - lengthFind + 1; } //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); char firstChar = s[0]; if (!caseSensitive) firstChar = static_cast(MakeUpperCase(firstChar)); int pos = forward ? startPos : (startPos - 1); while (forward ? (pos < endSearch) : (pos >= endSearch)) { char ch = CharAt(pos); if (caseSensitive) { if (ch == firstChar) { bool found = true; if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false; for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) { ch = CharAt(pos + posMatch); if (ch != s[posMatch]) found = false; } if (found) { if ((!word && !wordStart) || word && IsWordAt(pos, pos + lengthFind) || wordStart && IsWordStartAt(pos)) return pos; } } } else { if (MakeUpperCase(ch) == firstChar) { bool found = true; if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false; for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) { ch = CharAt(pos + posMatch); if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch])) found = false; } if (found) { if ((!word && !wordStart) || word && IsWordAt(pos, pos + lengthFind) || wordStart && IsWordStartAt(pos)) return pos; } } } pos += increment; if (dbcsCodePage && (pos >= 0)) { // Ensure trying to match from start of character pos = MovePositionOutsideChar(pos, increment, false); } } } //Platform::DebugPrintf("Not found\n"); return -1; } const char *Document::SubstituteByPosition(const char *text, int *length) { if (!pre) return 0; delete []substituted; substituted = 0; DocumentIndexer di(this, Length()); if (!pre->GrabMatches(di)) return 0; unsigned int lenResult = 0; for (int i = 0; i < *length; i++) { if (text[i] == '\\') { if (text[i + 1] >= '1' && text[i + 1] <= '9') { unsigned int patNum = text[i + 1] - '0'; lenResult += pre->eopat[patNum] - pre->bopat[patNum]; i++; } else { switch (text[i + 1]) { case 'a': case 'b': case 'f': case 'n': case 'r': case 't': case 'v': i++; } lenResult++; } } else { lenResult++; } } substituted = new char[lenResult + 1]; if (!substituted) return 0; char *o = substituted; for (int j = 0; j < *length; j++) { if (text[j] == '\\') { if (text[j + 1] >= '1' && text[j + 1] <= '9') { unsigned int patNum = text[j + 1] - '0'; unsigned int len = pre->eopat[patNum] - pre->bopat[patNum]; if (pre->pat[patNum]) // Will be null if try for a match that did not occur memcpy(o, pre->pat[patNum], len); o += len; j++; } else { j++; switch (text[j]) { case 'a': *o++ = '\a'; break; case 'b': *o++ = '\b'; break; case 'f': *o++ = '\f'; break; case 'n': *o++ = '\n'; break; case 'r': *o++ = '\r'; break; case 't': *o++ = '\t'; break; case 'v': *o++ = '\v'; break; default: *o++ = '\\'; j--; } } } else { *o++ = text[j]; } } *o = '\0'; *length = lenResult; return substituted; } int Document::LinesTotal() { return cb.Lines(); } void Document::ChangeCase(Range r, bool makeUpperCase) { for (int pos = r.start; pos < r.end;) { int len = LenChar(pos); if (len == 1) { char ch = CharAt(pos); if (makeUpperCase) { if (IsLowerCase(ch)) { ChangeChar(pos, static_cast(MakeUpperCase(ch))); } } else { if (IsUpperCase(ch)) { ChangeChar(pos, static_cast(MakeLowerCase(ch))); } } } pos += len; } } void Document::SetDefaultCharClasses(bool includeWordClass) { charClass.SetDefaultCharClasses(includeWordClass); } void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass) { charClass.SetCharClasses(chars, newCharClass); } void Document::SetStylingBits(int bits) { stylingBits = bits; stylingBitsMask = 0; for (int bit = 0; bit < stylingBits; bit++) { stylingBitsMask <<= 1; stylingBitsMask |= 1; } } void Document::StartStyling(int position, char mask) { stylingMask = mask; endStyled = position; } bool Document::SetStyleFor(int length, char style) { if (enteredStyling != 0) { return false; } else { enteredStyling++; style &= stylingMask; int prevEndStyled = endStyled; if (cb.SetStyleFor(endStyled, length, style, stylingMask)) { DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, prevEndStyled, length); NotifyModified(mh); } endStyled += length; enteredStyling--; return true; } } bool Document::SetStyles(int length, char *styles) { if (enteredStyling != 0) { return false; } else { enteredStyling++; bool didChange = false; int startMod = 0; int endMod = 0; for (int iPos = 0; iPos < length; iPos++, endStyled++) { PLATFORM_ASSERT(endStyled < Length()); if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) { if (!didChange) { startMod = endStyled; } didChange = true; endMod = endStyled; } } if (didChange) { DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, startMod, endMod - startMod + 1); NotifyModified(mh); } enteredStyling--; return true; } } void Document::EnsureStyledTo(int pos) { if ((enteredStyling == 0) && (pos > GetEndStyled())) { IncrementStyleClock(); // Ask the watchers to style, and stop as soon as one responds. for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) { watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos); } } } void Document::IncrementStyleClock() { styleClock++; if (styleClock > 0x100000) { styleClock = 0; } } void Document::DecorationFillRange(int position, int value, int fillLength) { if (decorations.FillRange(position, value, fillLength)) { DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER, position, fillLength); NotifyModified(mh); } } bool Document::AddWatcher(DocWatcher *watcher, void *userData) { for (int i = 0; i < lenWatchers; i++) { if ((watchers[i].watcher == watcher) && (watchers[i].userData == userData)) return false; } WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers + 1]; if (!pwNew) return false; for (int j = 0; j < lenWatchers; j++) pwNew[j] = watchers[j]; pwNew[lenWatchers].watcher = watcher; pwNew[lenWatchers].userData = userData; delete []watchers; watchers = pwNew; lenWatchers++; return true; } bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) { for (int i = 0; i < lenWatchers; i++) { if ((watchers[i].watcher == watcher) && (watchers[i].userData == userData)) { if (lenWatchers == 1) { delete []watchers; watchers = 0; lenWatchers = 0; } else { WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers]; if (!pwNew) return false; for (int j = 0; j < lenWatchers - 1; j++) { pwNew[j] = (j < i) ? watchers[j] : watchers[j + 1]; } delete []watchers; watchers = pwNew; lenWatchers--; } return true; } } return false; } void Document::NotifyModifyAttempt() { for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifyModifyAttempt(this, watchers[i].userData); } } void Document::NotifySavePoint(bool atSavePoint) { for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifySavePoint(this, watchers[i].userData, atSavePoint); } } void Document::NotifyModified(DocModification mh) { for (int i = 0; i < lenWatchers; i++) { watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData); } } bool Document::IsWordPartSeparator(char ch) { return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch); } int Document::WordPartLeft(int pos) { if (pos > 0) { --pos; char startChar = cb.CharAt(pos); if (IsWordPartSeparator(startChar)) { while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) { --pos; } } if (pos > 0) { startChar = cb.CharAt(pos); --pos; if (IsLowerCase(startChar)) { while (pos > 0 && IsLowerCase(cb.CharAt(pos))) --pos; if (!IsUpperCase(cb.CharAt(pos)) && !IsLowerCase(cb.CharAt(pos))) ++pos; } else if (IsUpperCase(startChar)) { while (pos > 0 && IsUpperCase(cb.CharAt(pos))) --pos; if (!IsUpperCase(cb.CharAt(pos))) ++pos; } else if (IsADigit(startChar)) { while (pos > 0 && IsADigit(cb.CharAt(pos))) --pos; if (!IsADigit(cb.CharAt(pos))) ++pos; } else if (IsPunctuation(startChar)) { while (pos > 0 && IsPunctuation(cb.CharAt(pos))) --pos; if (!IsPunctuation(cb.CharAt(pos))) ++pos; } else if (isspacechar(startChar)) { while (pos > 0 && isspacechar(cb.CharAt(pos))) --pos; if (!isspacechar(cb.CharAt(pos))) ++pos; } else if (!isascii(startChar)) { while (pos > 0 && !isascii(cb.CharAt(pos))) --pos; if (isascii(cb.CharAt(pos))) ++pos; } else { ++pos; } } } return pos; } int Document::WordPartRight(int pos) { char startChar = cb.CharAt(pos); int length = Length(); if (IsWordPartSeparator(startChar)) { while (pos < length && IsWordPartSeparator(cb.CharAt(pos))) ++pos; startChar = cb.CharAt(pos); } if (!isascii(startChar)) { while (pos < length && !isascii(cb.CharAt(pos))) ++pos; } else if (IsLowerCase(startChar)) { while (pos < length && IsLowerCase(cb.CharAt(pos))) ++pos; } else if (IsUpperCase(startChar)) { if (IsLowerCase(cb.CharAt(pos + 1))) { ++pos; while (pos < length && IsLowerCase(cb.CharAt(pos))) ++pos; } else { while (pos < length && IsUpperCase(cb.CharAt(pos))) ++pos; } if (IsLowerCase(cb.CharAt(pos)) && IsUpperCase(cb.CharAt(pos - 1))) --pos; } else if (IsADigit(startChar)) { while (pos < length && IsADigit(cb.CharAt(pos))) ++pos; } else if (IsPunctuation(startChar)) { while (pos < length && IsPunctuation(cb.CharAt(pos))) ++pos; } else if (isspacechar(startChar)) { while (pos < length && isspacechar(cb.CharAt(pos))) ++pos; } else { ++pos; } return pos; } bool IsLineEndChar(char c) { return (c == '\n' || c == '\r'); } int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { int sStart = cb.StyleAt(pos); if (delta < 0) { while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) pos--; pos++; } else { while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) pos++; } return pos; } static char BraceOpposite(char ch) { switch (ch) { case '(': return ')'; case ')': return '('; case '[': return ']'; case ']': return '['; case '{': return '}'; case '}': return '{'; case '<': return '>'; case '>': return '<'; default: return '\0'; } } // TODO: should be able to extend styled region to find matching brace int Document::BraceMatch(int position, int /*maxReStyle*/) { char chBrace = CharAt(position); char chSeek = BraceOpposite(chBrace); if (chSeek == '\0') return - 1; char styBrace = static_cast(StyleAt(position) & stylingBitsMask); int direction = -1; if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') direction = 1; int depth = 1; position = position + direction; while ((position >= 0) && (position < Length())) { position = MovePositionOutsideChar(position, direction); char chAtPos = CharAt(position); char styAtPos = static_cast(StyleAt(position) & stylingBitsMask); if ((position > GetEndStyled()) || (styAtPos == styBrace)) { if (chAtPos == chBrace) depth++; if (chAtPos == chSeek) depth--; if (depth == 0) return position; } position = position + direction; } return - 1; } sqliteman-1.2.2/sqliteman/qscintilla2/src/LexCsound.cpp0000644000175000001440000001416511407213302022542 0ustar subzerousers// Scintilla source code edit control /** @file LexCsound.cxx ** Lexer for Csound (Orchestra & Score) ** Written by Georg Ritter - **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '?'); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' || ch == '%' || ch == '@' || ch == '$' || ch == '?'); } static inline bool IsCsoundOperator(char ch) { if (isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '^' || ch == '[' || ch == ']' || ch == '<' || ch == '&' || ch == '>' || ch == ',' || ch == '|' || ch == '~' || ch == '%' || ch == ':') return true; return false; } static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &opcode = *keywordlists[0]; WordList &headerStmt = *keywordlists[1]; WordList &otherKeyword = *keywordlists[2]; // Do not leak onto next line if (initStyle == SCE_CSOUND_STRINGEOL) initStyle = SCE_CSOUND_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // Handle line continuation generically. if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate. if (sc.state == SCE_CSOUND_OPERATOR) { if (!IsCsoundOperator(static_cast(sc.ch))) { sc.SetState(SCE_CSOUND_DEFAULT); } }else if (sc.state == SCE_CSOUND_NUMBER) { if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_CSOUND_DEFAULT); } } else if (sc.state == SCE_CSOUND_IDENTIFIER) { if (!IsAWordChar(sc.ch) ) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (opcode.InList(s)) { sc.ChangeState(SCE_CSOUND_OPCODE); } else if (headerStmt.InList(s)) { sc.ChangeState(SCE_CSOUND_HEADERSTMT); } else if (otherKeyword.InList(s)) { sc.ChangeState(SCE_CSOUND_USERKEYWORD); } else if (s[0] == 'p') { sc.ChangeState(SCE_CSOUND_PARAM); } else if (s[0] == 'a') { sc.ChangeState(SCE_CSOUND_ARATE_VAR); } else if (s[0] == 'k') { sc.ChangeState(SCE_CSOUND_KRATE_VAR); } else if (s[0] == 'i') { // covers both i-rate variables and i-statements sc.ChangeState(SCE_CSOUND_IRATE_VAR); } else if (s[0] == 'g') { sc.ChangeState(SCE_CSOUND_GLOBAL_VAR); } sc.SetState(SCE_CSOUND_DEFAULT); } } else if (sc.state == SCE_CSOUND_COMMENT ) { if (sc.atLineEnd) { sc.SetState(SCE_CSOUND_DEFAULT); } } else if ((sc.state == SCE_CSOUND_ARATE_VAR) || (sc.state == SCE_CSOUND_KRATE_VAR) || (sc.state == SCE_CSOUND_IRATE_VAR)) { if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_CSOUND_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_CSOUND_DEFAULT) { if (sc.ch == ';'){ sc.SetState(SCE_CSOUND_COMMENT); } else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) { sc.SetState(SCE_CSOUND_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_CSOUND_IDENTIFIER); } else if (IsCsoundOperator(static_cast(sc.ch))) { sc.SetState(SCE_CSOUND_OPERATOR); } else if (sc.ch == 'p') { sc.SetState(SCE_CSOUND_PARAM); } else if (sc.ch == 'a') { sc.SetState(SCE_CSOUND_ARATE_VAR); } else if (sc.ch == 'k') { sc.SetState(SCE_CSOUND_KRATE_VAR); } else if (sc.ch == 'i') { // covers both i-rate variables and i-statements sc.SetState(SCE_CSOUND_IRATE_VAR); } else if (sc.ch == 'g') { sc.SetState(SCE_CSOUND_GLOBAL_VAR); } } } sc.Complete(); } static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[], Accessor &styler) { unsigned int lengthDoc = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int stylePrev = 0; int styleNext = styler.StyleAt(startPos); for (unsigned int i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if ((stylePrev != SCE_CSOUND_OPCODE) && (style == SCE_CSOUND_OPCODE)) { char s[20]; unsigned int j = 0; while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) { s[j] = styler[i + j]; j++; } s[j] = '\0'; if (strcmp(s, "instr") == 0) levelCurrent++; if (strcmp(s, "endin") == 0) levelCurrent--; } if (atEOL) { int lev = levelPrev; if (visibleChars == 0) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; stylePrev = style; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const csoundWordListDesc[] = { "Opcodes", "Header Statements", "User keywords", 0 }; LexerModule lmCsound(SCLEX_CSOUND, ColouriseCsoundDoc, "csound", FoldCsoundInstruments, csoundWordListDesc); sqliteman-1.2.2/sqliteman/qscintilla2/src/ViewStyle.cpp0000644000175000001440000002347411407213302022574 0ustar subzerousers// Scintilla source code edit control /** @file ViewStyle.cxx ** Store information on how the document is to be viewed. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include "Platform.h" #include "Scintilla.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" #include "Indicator.h" #include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "ViewStyle.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif MarginStyle::MarginStyle() : style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) { } // A list of the fontnames - avoids wasting space in each style FontNames::FontNames() { size = 8; names = new char *[size]; max = 0; } FontNames::~FontNames() { Clear(); delete []names; names = 0; } void FontNames::Clear() { for (int i=0;i= size) { // Grow array int sizeNew = size * 2; char **namesNew = new char *[sizeNew]; for (int j=0;j 0) maskInLine &= ~ms[margin].mask; } zoomLevel = 0; viewWhitespace = wsInvisible; viewIndentationGuides = false; viewEOL = false; showMarkedLines = true; extraFontFlag = false; } void ViewStyle::RefreshColourPalette(Palette &pal, bool want) { unsigned int i; for (i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) { pal.WantFind(styles[i].fore, want); pal.WantFind(styles[i].back, want); } for (i=0;i<(sizeof(indicators)/sizeof(indicators[0]));i++) { pal.WantFind(indicators[i].fore, want); } for (i=0;i<(sizeof(markers)/sizeof(markers[0]));i++) { markers[i].RefreshColourPalette(pal, want); } pal.WantFind(selforeground, want); pal.WantFind(selbackground, want); pal.WantFind(selbackground2, want); pal.WantFind(foldmarginColour, want); pal.WantFind(foldmarginHighlightColour, want); pal.WantFind(whitespaceForeground, want); pal.WantFind(whitespaceBackground, want); pal.WantFind(selbar, want); pal.WantFind(selbarlight, want); pal.WantFind(caretcolour, want); pal.WantFind(caretLineBackground, want); pal.WantFind(edgecolour, want); pal.WantFind(hotspotForeground, want); pal.WantFind(hotspotBackground, want); } void ViewStyle::Refresh(Surface &surface) { selbar.desired = Platform::Chrome(); selbarlight.desired = Platform::ChromeHighlight(); styles[STYLE_DEFAULT].Realise(surface, zoomLevel, NULL, extraFontFlag); maxAscent = styles[STYLE_DEFAULT].ascent; maxDescent = styles[STYLE_DEFAULT].descent; someStylesProtected = false; for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) { if (i != STYLE_DEFAULT) { styles[i].Realise(surface, zoomLevel, &styles[STYLE_DEFAULT], extraFontFlag); if (maxAscent < styles[i].ascent) maxAscent = styles[i].ascent; if (maxDescent < styles[i].descent) maxDescent = styles[i].descent; } if (styles[i].IsProtected()) { someStylesProtected = true; } } lineHeight = maxAscent + maxDescent; aveCharWidth = styles[STYLE_DEFAULT].aveCharWidth; spaceWidth = styles[STYLE_DEFAULT].spaceWidth; fixedColumnWidth = leftMarginWidth; symbolMargin = false; maskInLine = 0xffffffff; for (int margin=0; margin < margins; margin++) { fixedColumnWidth += ms[margin].width; symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER); if (ms[margin].width > 0) maskInLine &= ~ms[margin].mask; } } void ViewStyle::ResetDefaultStyle() { styles[STYLE_DEFAULT].Clear(ColourDesired(0,0,0), ColourDesired(0xff,0xff,0xff), Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), SC_CHARSET_DEFAULT, false, false, false, false, Style::caseMixed, true, true, false); } void ViewStyle::ClearStyles() { // Reset all styles to be like the default style for (unsigned int i=0;i<(sizeof(styles)/sizeof(styles[0]));i++) { if (i != STYLE_DEFAULT) { styles[i].ClearTo(styles[STYLE_DEFAULT]); } } styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); // Set call tip fore/back to match the values previously set for call tips styles[STYLE_CALLTIP].back.desired = ColourDesired(0xff, 0xff, 0xff); styles[STYLE_CALLTIP].fore.desired = ColourDesired(0x80, 0x80, 0x80); } void ViewStyle::SetStyleFontName(int styleIndex, const char *name) { styles[styleIndex].fontName = fontNames.Save(name); } bool ViewStyle::ProtectionActive() const { return someStylesProtected; } sqliteman-1.2.2/sqliteman/qscintilla2/src/LexHTML.cpp0000644000175000001440000017413011407213302022052 0ustar subzerousers// Scintilla source code edit control /** @file LexHTML.cxx ** Lexer for HTML. **/ // Copyright 1998-2005 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include "Platform.h" #include "PropSet.h" #include "Accessor.h" #include "StyleContext.h" #include "KeyWords.h" #include "Scintilla.h" #include "SciLexer.h" #include "CharacterSet.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif #define SCE_HA_JS (SCE_HJA_START - SCE_HJ_START) #define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START) #define SCE_HA_PYTHON (SCE_HPA_START - SCE_HP_START) enum script_type { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock }; enum script_mode { eHtml = 0, eNonHtmlScript, eNonHtmlPreProc, eNonHtmlScriptPreProc }; static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static inline int MakeLowerCase(int ch) { if (ch < 'A' || ch > 'Z') return ch; else return ch - 'A' + 'a'; } static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) { size_t i = 0; for (; (i < end - start + 1) && (i < len-1); i++) { s[i] = static_cast(MakeLowerCase(styler[start + i])); } s[i] = '\0'; } static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); //Platform::DebugPrintf("Scripting indicator [%s]\n", s); if (strstr(s, "src")) // External script return eScriptNone; if (strstr(s, "vbs")) return eScriptVBS; if (strstr(s, "pyth")) return eScriptPython; if (strstr(s, "javas")) return eScriptJS; if (strstr(s, "jscr")) return eScriptJS; if (strstr(s, "php")) return eScriptPHP; if (strstr(s, "xml")) return eScriptXML; return prevValue; } static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) { int iResult = 0; char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); if (0 == strncmp(s, "php", 3)) { iResult = 3; } return iResult; } static script_type ScriptOfState(int state) { if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) { return eScriptPython; } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) { return eScriptVBS; } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) { return eScriptJS; } else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) { return eScriptPHP; } else if ((state >= SCE_H_SGML_DEFAULT) && (state < SCE_H_SGML_BLOCK_DEFAULT)) { return eScriptSGML; } else if (state == SCE_H_SGML_BLOCK_DEFAULT) { return eScriptSGMLblock; } else { return eScriptNone; } } static int statePrintForState(int state, script_mode inScriptType) { int StateToPrint = state; if (state >= SCE_HJ_START) { if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) { StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_PYTHON); } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) { StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_VBS); } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) { StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS); } } return StateToPrint; } static int stateForPrintState(int StateToPrint) { int state; if ((StateToPrint >= SCE_HPA_START) && (StateToPrint <= SCE_HPA_IDENTIFIER)) { state = StateToPrint - SCE_HA_PYTHON; } else if ((StateToPrint >= SCE_HBA_START) && (StateToPrint <= SCE_HBA_STRINGEOL)) { state = StateToPrint - SCE_HA_VBS; } else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_REGEX)) { state = StateToPrint - SCE_HA_JS; } else { state = StateToPrint; } return state; } static inline bool IsNumber(unsigned int start, Accessor &styler) { return IsADigit(styler[start]) || (styler[start] == '.') || (styler[start] == '-') || (styler[start] == '#'); } static inline bool isStringState(int state) { bool bResult; switch (state) { case SCE_HJ_DOUBLESTRING: case SCE_HJ_SINGLESTRING: case SCE_HJA_DOUBLESTRING: case SCE_HJA_SINGLESTRING: case SCE_HB_STRING: case SCE_HBA_STRING: case SCE_HP_STRING: case SCE_HP_CHARACTER: case SCE_HP_TRIPLE: case SCE_HP_TRIPLEDOUBLE: case SCE_HPA_STRING: case SCE_HPA_CHARACTER: case SCE_HPA_TRIPLE: case SCE_HPA_TRIPLEDOUBLE: case SCE_HPHP_HSTRING: case SCE_HPHP_SIMPLESTRING: case SCE_HPHP_HSTRING_VARIABLE: case SCE_HPHP_COMPLEX_VARIABLE: bResult = true; break; default : bResult = false; break; } return bResult; } static inline bool stateAllowsTermination(int state) { bool allowTermination = !isStringState(state); if (allowTermination) { switch (state) { case SCE_HB_COMMENTLINE: case SCE_HPHP_COMMENT: case SCE_HP_COMMENTLINE: case SCE_HPA_COMMENTLINE: allowTermination = false; } } return allowTermination; } // not really well done, since it's only comments that should lex the %> and <% static inline bool isCommentASPState(int state) { bool bResult; switch (state) { case SCE_HJ_COMMENT: case SCE_HJ_COMMENTLINE: case SCE_HJ_COMMENTDOC: case SCE_HB_COMMENTLINE: case SCE_HP_COMMENTLINE: case SCE_HPHP_COMMENT: case SCE_HPHP_COMMENTLINE: bResult = true; break; default : bResult = false; break; } return bResult; } static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { bool wordIsNumber = IsNumber(start, styler); char chAttr = SCE_H_ATTRIBUTEUNKNOWN; if (wordIsNumber) { chAttr = SCE_H_NUMBER; } else { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); if (keywords.InList(s)) chAttr = SCE_H_ATTRIBUTE; } if ((chAttr == SCE_H_ATTRIBUTEUNKNOWN) && !keywords) // No keywords -> all are known chAttr = SCE_H_ATTRIBUTE; styler.ColourTo(end, chAttr); } static int classifyTagHTML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, bool &tagDontFold, bool caseSensitive, bool isXml) { char s[30 + 2]; // Copy after the '<' unsigned int i = 0; for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) { char ch = styler[cPos]; if ((ch != '<') && (ch != '/')) { s[i++] = caseSensitive ? ch : static_cast(MakeLowerCase(ch)); } } //The following is only a quick hack, to see if this whole thing would work //we first need the tagname with a trailing space... s[i] = ' '; s[i+1] = '\0'; // if the current language is XML, I can fold any tag // if the current language is HTML, I don't want to fold certain tags (input, meta, etc.) //...to find it in the list of no-container-tags tagDontFold = (!isXml) && (NULL != strstr("meta link img area br hr input ",s)); //now we can remove the trailing space s[i] = '\0'; bool isScript = false; char chAttr = SCE_H_TAGUNKNOWN; if (s[0] == '!') { chAttr = SCE_H_SGML_DEFAULT; } else if (s[0] == '/') { // Closing tag if (keywords.InList(s + 1)) chAttr = SCE_H_TAG; } else { if (keywords.InList(s)) { chAttr = SCE_H_TAG; isScript = 0 == strcmp(s, "script"); } } if ((chAttr == SCE_H_TAGUNKNOWN) && !keywords) { // No keywords -> all are known chAttr = SCE_H_TAG; isScript = 0 == strcmp(s, "script"); } styler.ColourTo(end, chAttr); return isScript ? SCE_H_SCRIPT : chAttr; } static void classifyWordHTJS(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) { char chAttr = SCE_HJ_WORD; bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); if (wordIsNumber) chAttr = SCE_HJ_NUMBER; else { char s[30 + 1]; unsigned int i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } s[i] = '\0'; if (keywords.InList(s)) chAttr = SCE_HJ_KEYWORD; } styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); } static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) { char chAttr = SCE_HB_IDENTIFIER; bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); if (wordIsNumber) chAttr = SCE_HB_NUMBER; else { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); if (keywords.InList(s)) { chAttr = SCE_HB_WORD; if (strcmp(s, "rem") == 0) chAttr = SCE_HB_COMMENTLINE; } } styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); if (chAttr == SCE_HB_COMMENTLINE) return SCE_HB_COMMENTLINE; else return SCE_HB_DEFAULT; } static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType) { bool wordIsNumber = IsADigit(styler[start]); char s[30 + 1]; unsigned int i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } s[i] = '\0'; char chAttr = SCE_HP_IDENTIFIER; if (0 == strcmp(prevWord, "class")) chAttr = SCE_HP_CLASSNAME; else if (0 == strcmp(prevWord, "def")) chAttr = SCE_HP_DEFNAME; else if (wordIsNumber) chAttr = SCE_HP_NUMBER; else if (keywords.InList(s)) chAttr = SCE_HP_WORD; styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); strcpy(prevWord, s); } // Update the word colour to default or keyword // Called when in a PHP word static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char chAttr = SCE_HPHP_DEFAULT; bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1])); if (wordIsNumber) chAttr = SCE_HPHP_NUMBER; else { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); if (keywords.InList(s)) chAttr = SCE_HPHP_WORD; } styler.ColourTo(end, chAttr); } static bool isWordHSGML(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char s[30 + 1]; unsigned int i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } s[i] = '\0'; return keywords.InList(s); } static bool isWordCdata(unsigned int start, unsigned int end, Accessor &styler) { char s[30 + 1]; unsigned int i = 0; for (; i < end - start + 1 && i < 30; i++) { s[i] = styler[start + i]; } s[i] = '\0'; return (0 == strcmp(s, "[CDATA[")); } // Return the first state to reach when entering a scripting language static int StateForScript(script_type scriptLanguage) { int Result; switch (scriptLanguage) { case eScriptVBS: Result = SCE_HB_START; break; case eScriptPython: Result = SCE_HP_START; break; case eScriptPHP: Result = SCE_HPHP_DEFAULT; break; case eScriptXML: Result = SCE_H_TAGUNKNOWN; break; case eScriptSGML: Result = SCE_H_SGML_DEFAULT; break; default : Result = SCE_HJ_START; break; } return Result; } static inline bool ishtmlwordchar(char ch) { return !isascii(ch) || (isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#'); } static inline bool issgmlwordchar(char ch) { return !isascii(ch) || (isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '['); } static inline bool IsPhpWordStart(const unsigned char ch) { return (isascii(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f); } static inline bool IsPhpWordChar(char ch) { return IsADigit(ch) || IsPhpWordStart(ch); } static bool InTagState(int state) { return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN || state == SCE_H_SCRIPT || state == SCE_H_ATTRIBUTE || state == SCE_H_ATTRIBUTEUNKNOWN || state == SCE_H_NUMBER || state == SCE_H_OTHER || state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING; } static bool IsCommentState(const int state) { return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT; } static bool IsScriptCommentState(const int state) { return state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTLINE || state == SCE_HJA_COMMENT || state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE; } static bool isLineEnd(char ch) { return ch == '\r' || ch == '\n'; } static bool isOKBeforeRE(char ch) { return (ch == '(') || (ch == '=') || (ch == ','); } static bool isPHPStringState(int state) { return (state == SCE_HPHP_HSTRING) || (state == SCE_HPHP_SIMPLESTRING) || (state == SCE_HPHP_HSTRING_VARIABLE) || (state == SCE_HPHP_COMPLEX_VARIABLE); } static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler) { int j; while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t')) i++; phpStringDelimiter[0] = '\n'; for (j = i; j < lengthDoc && styler[j] != '\n' && styler[j] != '\r'; j++) { if (j - i < phpStringDelimiterSize - 2) phpStringDelimiter[j-i+1] = styler[j]; else i++; } phpStringDelimiter[j-i+1] = '\0'; return j; } static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler, bool isXml) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; WordList &keywords5 = *keywordlists[4]; WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords // Lexer for HTML requires more lexical states (7 bits worth) than most lexers styler.StartAt(startPos, STYLE_MAX); char prevWord[200]; prevWord[0] = '\0'; char phpStringDelimiter[200]; // PHP is not limited in length, we are phpStringDelimiter[0] = '\0'; int StateToPrint = initStyle; int state = stateForPrintState(StateToPrint); // If inside a tag, it may be a script tag, so reread from the start to ensure any language tags are seen if (InTagState(state)) { while ((startPos > 0) && (InTagState(styler.StyleAt(startPos - 1)))) { startPos--; length++; } state = SCE_H_DEFAULT; } // String can be heredoc, must find a delimiter first while (startPos > 0 && isPHPStringState(state) && state != SCE_HPHP_SIMPLESTRING) { startPos--; length++; state = styler.StyleAt(startPos); } styler.StartAt(startPos, STYLE_MAX); int lineCurrent = styler.GetLine(startPos); int lineState; if (lineCurrent > 0) { lineState = styler.GetLineState(lineCurrent); } else { // Default client and ASP scripting language is JavaScript lineState = eScriptJS << 8; lineState |= styler.GetPropertyInt("asp.default.language", eScriptJS) << 4; } script_mode inScriptType = script_mode((lineState >> 0) & 0x03); // 2 bits of scripting mode bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag bool tagDontFold = false; //some HTML tags should not be folded script_type aspScript = script_type((lineState >> 4) & 0x0F); // 4 bits of script name script_type clientScript = script_type((lineState >> 8) & 0x0F); // 4 bits of script name int beforePreProc = (lineState >> 12) & 0xFF; // 8 bits of state script_type scriptLanguage = ScriptOfState(state); const bool foldHTML = styler.GetPropertyInt("fold.html", 0) != 0; const bool fold = foldHTML && styler.GetPropertyInt("fold", 0); const bool foldHTMLPreprocessor = foldHTML && styler.GetPropertyInt("fold.html.preprocessor", 1); const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; const bool caseSensitive = styler.GetPropertyInt("html.tags.case.sensitive", 0) != 0; const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true); const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true); const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int visibleChars = 0; char chPrev = ' '; char ch = ' '; char chPrevNonWhite = ' '; // look back to set chPrevNonWhite properly for better regex colouring if (scriptLanguage == eScriptJS && startPos > 0) { int back = startPos; int style = 0; while (--back) { style = styler.StyleAt(back); if (style < SCE_HJ_DEFAULT || style > SCE_HJ_COMMENTDOC) // includes SCE_HJ_COMMENT & SCE_HJ_COMMENTLINE break; } if (style == SCE_HJ_SYMBOLS) { chPrevNonWhite = styler.SafeGetCharAt(back); } } styler.StartSegment(startPos); const int lengthDoc = startPos + length; for (int i = startPos; i < lengthDoc; i++) { const char chPrev2 = chPrev; chPrev = ch; if (!isspacechar(ch) && state != SCE_HJ_COMMENT && state != SCE_HJ_COMMENTLINE && state != SCE_HJ_COMMENTDOC) chPrevNonWhite = ch; ch = styler[i]; char chNext = styler.SafeGetCharAt(i + 1); const char chNext2 = styler.SafeGetCharAt(i + 2); // Handle DBCS codepages if (styler.IsLeadByte(ch)) { chPrev = ' '; i += 1; continue; } if ((!isspacechar(ch) || !foldCompact) && fold) visibleChars++; // decide what is the current state to print (depending of the script tag) StateToPrint = statePrintForState(state, inScriptType); // handle script folding if (fold) { switch (scriptLanguage) { case eScriptJS: case eScriptPHP: //not currently supported case eScriptVBS: if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC) && (!isStringState(state))) { //Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle); //if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) { if ((ch == '{') || (ch == '}')) { levelCurrent += (ch == '{') ? 1 : -1; } } break; case eScriptPython: if (state != SCE_HP_COMMENTLINE) { if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) { levelCurrent++; } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) { // check if the number of tabs is lower than the level int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8; for (int j = 0; Findlevel > 0; j++) { char chTmp = styler.SafeGetCharAt(i + j + 1); if (chTmp == '\t') { Findlevel -= 8; } else if (chTmp == ' ') { Findlevel--; } else { break; } } if (Findlevel > 0) { levelCurrent -= Findlevel / 8; if (Findlevel % 8) levelCurrent--; } } } break; default: break; } } if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix) // Avoid triggering two times on Dos/Win // New line -> record any line state onto /next/ line if (fold) { int lev = levelPrev; if (visibleChars == 0) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; styler.SetLevel(lineCurrent, lev); visibleChars = 0; levelPrev = levelCurrent; } lineCurrent++; styler.SetLineState(lineCurrent, ((inScriptType & 0x03) << 0) | ((tagOpened & 0x01) << 2) | ((tagClosing & 0x01) << 3) | ((aspScript & 0x0F) << 4) | ((clientScript & 0x0F) << 8) | ((beforePreProc & 0xFF) << 12)); } // generic end of script processing else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) { // Check if it's the end of the script tag (or any other HTML tag) switch (state) { // in these cases, you can embed HTML tags (to confirm !!!!!!!!!!!!!!!!!!!!!!) case SCE_H_DOUBLESTRING: case SCE_H_SINGLESTRING: case SCE_HJ_COMMENT: case SCE_HJ_COMMENTDOC: //case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide // the end of script marker from some JS interpreters. case SCE_HJ_DOUBLESTRING: case SCE_HJ_SINGLESTRING: case SCE_HJ_REGEX: case SCE_HB_STRING: case SCE_HP_STRING: case SCE_HP_TRIPLE: case SCE_HP_TRIPLEDOUBLE: break; default : // check if the closing tag is a script tag if (state == SCE_HJ_COMMENTLINE || isXml) { char tag[7]; // room for the