SF.net SVN: geany:[3290] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sat Nov 29 12:51:51 UTC 2008
Revision: 3290
http://geany.svn.sourceforge.net/geany/?rev=3290&view=rev
Author: eht16
Date: 2008-11-29 12:51:50 +0000 (Sat, 29 Nov 2008)
Log Message:
-----------
Add new filetype 'YAML' (patch by Walery Studennikov, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/THANKS
trunk/data/filetype_extensions.conf
trunk/scintilla/KeyWords.cxx
trunk/scintilla/Makefile.am
trunk/scintilla/makefile.win32
trunk/src/about.c
trunk/src/editor.c
trunk/src/filetypes.c
trunk/src/filetypes.h
trunk/src/highlighting.c
trunk/src/plugindata.h
trunk/src/templates.c
trunk/wscript
Added Paths:
-----------
trunk/data/filetypes.yaml
trunk/scintilla/LexYAML.cxx
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/ChangeLog 2008-11-29 12:51:50 UTC (rev 3290)
@@ -8,6 +8,12 @@
src/treeviews.h:
Add editor_get_calltip_text().
Add tooltips for the symbol list items.
+ * wscript, THANKS, data/filetypes.yaml, data/filetype_extensions.conf,
+ scintilla/LexYAML.cxx, scintilla/KeyWords.cxx, scintilla/Makefile.am,
+ scintilla/makefile.win32, src/filetypes.c, src/templates.c,
+ src/filetypes.h, src/highlighting.c, src/plugindata.h, src/editor.c,
+ src/about.c:
+ Add new filetype 'YAML' (patch by Walery Studennikov, thanks).
2008-11-28 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/THANKS
===================================================================
--- trunk/THANKS 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/THANKS 2008-11-29 12:51:50 UTC (rev 3290)
@@ -55,6 +55,7 @@
Herbert Voss <voss(at)perce(dot)de> - LaTeX file template
Moritz Barsnick <barsnick(at)users(dot)sourceforge(dot)net> - Split Vertically command
Tyler D'Agosta - Add missing HTML entities
+Walery Studennikov <despairr(at)gmail(dot)com> - YAML filetype patch
Translators:
------------
Modified: trunk/data/filetype_extensions.conf
===================================================================
--- trunk/data/filetype_extensions.conf 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/data/filetype_extensions.conf 2008-11-29 12:51:50 UTC (rev 3290)
@@ -43,4 +43,5 @@
reStructuredText=*.rest;*.reST;*.rst;
SQL=*.sql;
Po=*.po;*.pot;
+YAML=*.yaml;*.yml;
None=*;
Added: trunk/data/filetypes.yaml
===================================================================
--- trunk/data/filetypes.yaml (rev 0)
+++ trunk/data/filetypes.yaml 2008-11-29 12:51:50 UTC (rev 3290)
@@ -0,0 +1,41 @@
+# For complete documentation of this file, please see Geany's main documentation
+[styling]
+# foreground;background;bold;italic
+default=0x000000;0xffffff;false;false
+comment=0x808080;0xffffff;false;false
+identifier=0x000088;0xffffff;true;false
+keyword=0x991111;0xffffff;true;false
+number=0x007f00;0xffffff;false;false
+reference=0x008888;0xffffff;false;false
+document=0x000088;0xffffff;false;false
+text=0x333366;0xffffff;false;false
+error=0xff0000;0xffffff;true;true
+operator=0x301010;0xffffff;false;false
+
+
+[keywords]
+# all items must be in one line
+keywords=true false yes no
+
+
+[settings]
+# default extension used when saving files
+extension=yaml
+
+# the following characters are these which a "word" can contains, see documentation
+#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
+
+# if only single comment char is supported like # in this file, leave comment_close blank
+comment_open=#
+comment_close=
+
+# set to false if a comment character/string should start at column 0 of a line, true uses any
+# indentation of the line, e.g. setting to true causes the following on pressing CTRL+d
+ #command_example();
+# setting to false would generate this
+# command_example();
+# This setting works only for single line comments
+comment_use_indent=true
+
+# context action command (please see Geany's main documentation for details)
+context_action_cmd=
Modified: trunk/scintilla/KeyWords.cxx
===================================================================
--- trunk/scintilla/KeyWords.cxx 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/scintilla/KeyWords.cxx 2008-11-29 12:51:50 UTC (rev 3290)
@@ -170,6 +170,7 @@
LINK_LEXER(lmTCL);
LINK_LEXER(lmVHDL);
LINK_LEXER(lmXML);
+ LINK_LEXER(lmYAML);
//--Autogenerated -- end of automatically generated section
Added: trunk/scintilla/LexYAML.cxx
===================================================================
--- trunk/scintilla/LexYAML.cxx (rev 0)
+++ trunk/scintilla/LexYAML.cxx 2008-11-29 12:51:50 UTC (rev 3290)
@@ -0,0 +1,313 @@
+// Scintilla source code edit control
+/** @file LexYAML.cxx
+ ** Lexer for YAML.
+ **/
+// Copyright 2003- by Sean O'Dell <sean at celsoft.com>
+// Release under the same license as Scintilla/SciTE.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+#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 - 1, SCE_YAML_IDENTIFIER);
+ styler.ColourTo(startLine + i, SCE_YAML_OPERATOR);
+ // 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;
+ }
+ } else if (lineBuffer[i] == '#') {
+ styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT);
+ styler.ColourTo(endPos, SCE_YAML_COMMENT);
+ 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 (!(isascii(lineBuffer[i]) && 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);
Property changes on: trunk/scintilla/LexYAML.cxx
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/scintilla/Makefile.am
===================================================================
--- trunk/scintilla/Makefile.am 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/scintilla/Makefile.am 2008-11-29 12:51:50 UTC (rev 3290)
@@ -17,6 +17,7 @@
LexFortran.cxx \
LexHaskell.cxx \
LexHTML.cxx \
+LexYAML.cxx \
LexLua.cxx \
LexOMS.cxx \
LexMatlab.cxx \
Modified: trunk/scintilla/makefile.win32
===================================================================
--- trunk/scintilla/makefile.win32 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/scintilla/makefile.win32 2008-11-29 12:51:50 UTC (rev 3290)
@@ -62,7 +62,7 @@
LEXOBJS=\
LexBash.o LexAsm.o LexCSS.o LexCPP.o LexCrontab.o LexHTML.o LexOthers.o LexPascal.o \
LexPerl.o LexPython.o LexSQL.o LexCaml.o LexOMS.o LexTCL.o LexRuby.o LexFortran.o LexVHDL.o LexMatlab.o \
-LexD.o LexLua.o LexHaskell.o LexBasic.o LexR.o
+LexD.o LexLua.o LexHaskell.o LexBasic.o LexR.o LexYAML.o
#--Autogenerated -- end of automatically generated section
all: $(COMPLIB)
Modified: trunk/src/about.c
===================================================================
--- trunk/src/about.c 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/src/about.c 2008-11-29 12:51:50 UTC (rev 3290)
@@ -83,7 +83,7 @@
"Giuseppe Torelli, Guillaume Hoffmann, Herbert Voss, Jason Oster, Jean-François Wauthy, Jeff Pohlmeyer, "
"John Gabriele, Josef Whiter, Kevin Ellwood, Kristoffer A. Tjernås, Marko Peric, Matti Mårds, Moritz Barsnick, "
"Peter Strand, Pierre Joye, Rob van der Linde, Robert McGinley, Roland Baudin, S Jagannathan, Saleem Abdulrasool, "
-"Sebastian Kraft, Shiv, Slava Semushin, Stefan Oltmanns, Tamim, Tomás Vírseda, Yura Siamashka";
+"Sebastian Kraft, Shiv, Slava Semushin, Stefan Oltmanns, Tamim, Tomás Vírseda, Walery Studennikov, Yura Siamashka";
static void header_eventbox_style_set(GtkWidget *widget);
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/src/editor.c 2008-11-29 12:51:50 UTC (rev 3290)
@@ -2934,6 +2934,9 @@
case SCLEX_FREEBASIC:
return (style == SCE_B_COMMENT);
+ case SCLEX_YAML:
+ return (style == SCE_YAML_COMMENT);
+
case SCLEX_HTML:
return (style == SCE_HPHP_COMMENTLINE ||
style == SCE_HPHP_COMMENT ||
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/src/filetypes.c 2008-11-29 12:51:50 UTC (rev 3290)
@@ -518,6 +518,17 @@
ft->comment_close = NULL;
ft->group = GEANY_FILETYPE_GROUP_SCRIPT;
+#define YAML
+ ft = filetypes[GEANY_FILETYPES_YAML];
+ ft->lang = -2;
+ ft->name = g_strdup("YAML");
+ ft->title = g_strdup_printf(_("%s source file"), "YAML");
+ ft->extension = g_strdup("yaml");
+ ft->pattern = utils_strv_new("*.yaml", "*.yml", NULL);
+ ft->comment_open = g_strdup("#");
+ ft->comment_close = NULL;
+ ft->group = GEANY_FILETYPE_GROUP_MISC;
+
#define ALL
ft = filetypes[GEANY_FILETYPES_NONE];
ft->lang = -2;
Modified: trunk/src/filetypes.h
===================================================================
--- trunk/src/filetypes.h 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/src/filetypes.h 2008-11-29 12:51:50 UTC (rev 3290)
@@ -72,15 +72,16 @@
GEANY_FILETYPES_CSS,
GEANY_FILETYPES_DOCBOOK,
GEANY_FILETYPES_HTML,
- GEANY_FILETYPES_XML,
+ GEANY_FILETYPES_XML,
/* miscellaneous languages */
GEANY_FILETYPES_CONF,
GEANY_FILETYPES_DIFF,
+ GEANY_FILETYPES_PO,
GEANY_FILETYPES_LATEX,
GEANY_FILETYPES_REST,
GEANY_FILETYPES_SQL,
- GEANY_FILETYPES_PO,
+ GEANY_FILETYPES_YAML,
GEANY_FILETYPES_NONE, /* must be last filetype */
GEANY_MAX_BUILT_IN_FILETYPES /* Use filetypes_array->len instead */
Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/src/highlighting.c 2008-11-29 12:51:50 UTC (rev 3290)
@@ -2883,6 +2883,52 @@
}
+static void styleset_yaml_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
+{
+ new_style_array(GEANY_FILETYPES_YAML, 10);
+
+ get_keyfile_hex(config, config_home, "styling", "default", "0x000000", "0xffffff", "false", &style_sets[GEANY_FILETYPES_YAML].styling[0]);
+ get_keyfile_hex(config, config_home, "styling", "comment", "0x808080", "0xffffff", "false", &style_sets[GEANY_FILETYPES_YAML].styling[1]);
+ get_keyfile_hex(config, config_home, "styling", "identifier", "0x000088", "0xffffff", "true", &style_sets[GEANY_FILETYPES_YAML].styling[2]);
+ get_keyfile_hex(config, config_home, "styling", "keyword", "0x991111", "0xffffff", "true", &style_sets[GEANY_FILETYPES_YAML].styling[3]);
+ get_keyfile_hex(config, config_home, "styling", "number", "0x007f00", "0xffffff", "false", &style_sets[GEANY_FILETYPES_YAML].styling[4]);
+ get_keyfile_hex(config, config_home, "styling", "reference", "0x008888", "0xffffff", "false", &style_sets[GEANY_FILETYPES_YAML].styling[5]);
+ get_keyfile_hex(config, config_home, "styling", "document", "0x000088", "0xffffff", "false", &style_sets[GEANY_FILETYPES_YAML].styling[6]);
+ get_keyfile_hex(config, config_home, "styling", "text", "0x333366", "0xffffff", "false", &style_sets[GEANY_FILETYPES_YAML].styling[7]);
+ get_keyfile_hex(config, config_home, "styling", "error", "0xff0000", "0xffffff", "true", &style_sets[GEANY_FILETYPES_YAML].styling[8]);
+ get_keyfile_hex(config, config_home, "styling", "operator", "0x301010", "0xffffff", "false", &style_sets[GEANY_FILETYPES_YAML].styling[9]);
+
+ style_sets[GEANY_FILETYPES_YAML].keywords = g_new(gchar*, 2);
+ get_keyfile_keywords(config, config_home, "keywords", "keywords", GEANY_FILETYPES_YAML, 0, "true false yes no");
+ style_sets[GEANY_FILETYPES_YAML].keywords[1] = NULL;
+
+ get_keyfile_wordchars(config, config_home,
+ &style_sets[GEANY_FILETYPES_VHDL].wordchars);
+}
+
+
+static void styleset_yaml(ScintillaObject *sci)
+{
+ const filetype_id ft_id = GEANY_FILETYPES_YAML;
+
+ apply_filetype_properties(sci, SCLEX_YAML, ft_id);
+
+ SSM(sci, SCI_SETKEYWORDS, 0, (sptr_t) style_sets[GEANY_FILETYPES_YAML].keywords[0]);
+
+ set_sci_style(sci, STYLE_DEFAULT, GEANY_FILETYPES_YAML, 0);
+ set_sci_style(sci, SCE_YAML_DEFAULT, GEANY_FILETYPES_YAML, 0);
+ set_sci_style(sci, SCE_YAML_COMMENT, GEANY_FILETYPES_YAML, 1);
+ set_sci_style(sci, SCE_YAML_IDENTIFIER, GEANY_FILETYPES_YAML, 2);
+ set_sci_style(sci, SCE_YAML_KEYWORD, GEANY_FILETYPES_YAML, 3);
+ set_sci_style(sci, SCE_YAML_NUMBER, GEANY_FILETYPES_YAML, 4);
+ set_sci_style(sci, SCE_YAML_REFERENCE, GEANY_FILETYPES_YAML, 5);
+ set_sci_style(sci, SCE_YAML_DOCUMENT, GEANY_FILETYPES_YAML, 6);
+ set_sci_style(sci, SCE_YAML_TEXT, GEANY_FILETYPES_YAML, 7);
+ set_sci_style(sci, SCE_YAML_ERROR, GEANY_FILETYPES_YAML, 8);
+ set_sci_style(sci, SCE_YAML_OPERATOR, GEANY_FILETYPES_YAML, 9);
+}
+
+
static void styleset_js_init(gint ft_id, GKeyFile *config, GKeyFile *config_home)
{
new_style_array(GEANY_FILETYPES_JS, 20);
@@ -3208,6 +3254,7 @@
init_styleset_case(GEANY_FILETYPES_VALA, vala);
init_styleset_case(GEANY_FILETYPES_VHDL, vhdl);
init_styleset_case(GEANY_FILETYPES_XML, markup);
+ init_styleset_case(GEANY_FILETYPES_YAML, yaml);
}
}
@@ -3266,6 +3313,7 @@
styleset_case(GEANY_FILETYPES_VALA, vala);
styleset_case(GEANY_FILETYPES_VHDL, vhdl);
styleset_case(GEANY_FILETYPES_XML, xml);
+ styleset_case(GEANY_FILETYPES_YAML, yaml);
default:
styleset_case(GEANY_FILETYPES_NONE, none);
}
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/src/plugindata.h 2008-11-29 12:51:50 UTC (rev 3290)
@@ -45,13 +45,13 @@
enum {
/** The Application Programming Interface (API) version, incremented
* whenever any plugin data types are modified or appended to. */
- GEANY_API_VERSION = 111,
+ GEANY_API_VERSION = 112,
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */
/* This should usually stay the same if fields are only appended, assuming only pointers to
* structs and not structs themselves are declared by plugins. */
- GEANY_ABI_VERSION = 50
+ GEANY_ABI_VERSION = 51
};
/** Check the plugin can be loaded by Geany.
Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/src/templates.c 2008-11-29 12:51:50 UTC (rev 3290)
@@ -577,6 +577,7 @@
case GEANY_FILETYPES_OMS:
case GEANY_FILETYPES_CONF:
case GEANY_FILETYPES_PO:
+ case GEANY_FILETYPES_YAML:
{
line_prefix = "#";
break;
Modified: trunk/wscript
===================================================================
--- trunk/wscript 2008-11-29 12:51:05 UTC (rev 3289)
+++ trunk/wscript 2008-11-29 12:51:50 UTC (rev 3290)
@@ -76,7 +76,7 @@
'scintilla/LexFortran.cxx', 'scintilla/LexHaskell.cxx', 'scintilla/LexHTML.cxx',
'scintilla/LexLua.cxx', 'scintilla/LexOMS.cxx', 'scintilla/LexOthers.cxx',
'scintilla/LexPascal.cxx', 'scintilla/LexPerl.cxx', 'scintilla/LexPython.cxx',
- 'scintilla/LexR.cxx', 'scintilla/LexMatlab.cxx',
+ 'scintilla/LexR.cxx', 'scintilla/LexMatlab.cxx', 'scintilla/LexYAML.cxx',
'scintilla/LexRuby.cxx', 'scintilla/LexSQL.cxx', 'scintilla/LexTCL.cxx',
'scintilla/LexVHDL.cxx', 'scintilla/LineMarker.cxx', 'scintilla/PlatGTK.cxx',
'scintilla/PositionCache.cxx', 'scintilla/PropSet.cxx', 'scintilla/RESearch.cxx',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list