AutoHotkey Community

It is currently May 27th, 2012, 5:37 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 123 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9  Next
Author Message
 Post subject:
PostPosted: February 20th, 2009, 9:58 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
I use my own SciTE distribution, called SciTE4AutoHotkey.
It is based on this lexer, by the way ;)

(mandatory SciTE4AutoHotkey v2 advertising post :lol:)

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Update to 1.76!
PostPosted: September 9th, 2009, 12:18 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
PhiLho wrote:
A quick note to say I finally found some time to finish a little script I started months ago (!) which injects the stuff needed to add LexAHK1 into Scintilla.

I updated my script as I wanted to compile SciTE 2.01 (it has a nifty multiline caret now! And like in Firefox, you can select several regions at once). It needed a couple of minor changes.

Here is the script itself. No update on the lexer itself.
Code:
/*
AddLexAHK1.ahk

Adds the lexer for AutoHotkey (LexAHK1.cxx) to Scintilla.
The cxx file must be in the same dir as the script, which must be in a dir above the scintilla dir.
The files modified are backed up with a _OLD suffix to the extension.
They are SciLexer.h and KeyWords.cxx

// by Philippe Lhoste <PhiLho(a)GMX.net> http://Phi.Lho.free.fr
// File/Project history:
 1.01.000 -- 2009/09/09 (PL) -- Update, for Scintilla 2.01
 1.00.000 -- 2008/07/01 (PL) -- Finished, at least!
 0.00.000 -- 2007/12/06 (PL) -- Creation.
*/
/* Copyright notice: For details, see the following file:
http://Phi.Lho.free.fr/softwares/PhiLhoSoft/PhiLhoSoftLicence.txt
This program is distributed under the zlib/libpng license.
Copyright (c) 2008-2009 Philippe Lhoste / PhiLhoSoft
*/
#SingleInstance Force

#NoEnv

; I have this directory structure: someDir\SciTE\vx.xx\scintilla | scite
; The script is put in SciTE dir
; Adjust the following lines depending on your settings
sciteVersion = v2.01
scintillaDir = %sciteVersion%\scintilla
SetWorkingDir %A_ScriptDir%

; For KeyWords.cxx and, in previous versions of Scintilla, for SciLexer.h too
endOfCodeMarkKW = //--Autogenerated -- end
; Since 1.77 or 1.78, for SciLexer.h
endOfCodeMarkSL = /* --Autogenerated -- end

;-- Copy the lexer at the proper place

FileCopy LexAHK1.cxx, %scintillaDir%\src

;-- Update the list of lexers

sciLexerFile = %scintillaDir%\include\SciLexer.h
FileRead source, %sciLexerFile%

; The line after the last defined lexer
lastLexer = #define SCLEX_AUTOMATIC
; Get current number of last defined lexer
RegExMatch(source, "#define SCLEX_.*? (\d+)\r\n" . lastLexer, lastLexNb)
; We go just after it!
lexNb := lastLexNb1 + 1
; And add it
StringReplace source, source, %lastLexer%, #define SCLEX_AHK1 %lexNb%`r`n%lastLexer%

; The lexer states
lexStates =
(
#define SCE_AHK_DEFAULT 0
#define SCE_AHK_COMMENTLINE 1
#define SCE_AHK_COMMENTBLOCK 2
#define SCE_AHK_ESCAPE 3
#define SCE_AHK_SYNOPERATOR 4
#define SCE_AHK_EXPOPERATOR 5
#define SCE_AHK_STRING 6
#define SCE_AHK_NUMBER 7
#define SCE_AHK_IDENTIFIER 8
#define SCE_AHK_VARREF 9
#define SCE_AHK_LABEL 10
#define SCE_AHK_WORD_CF 11
#define SCE_AHK_WORD_CMD 12
#define SCE_AHK_WORD_FN 13
#define SCE_AHK_WORD_DIR 14
#define SCE_AHK_WORD_KB 15
#define SCE_AHK_WORD_VAR 16
#define SCE_AHK_WORD_SP 17
#define SCE_AHK_WORD_UD 18
#define SCE_AHK_VARREFKW 19
#define SCE_AHK_ERROR 20
)
StringReplace source, source, %endOfCodeMarkSL%, %lexStates%`r`n%endOfCodeMarkSL%

; Keep just in case
FileMove %sciLexerFile%, %sciLexerFile%_OLD
; And put out version...
FileAppend %source%, %sciLexerFile%

;-- Update the lexer loader

scKWFile = %scintillaDir%\src\KeyWords.cxx
FileRead source, %scKWFile%

StringReplace source, source, `r`n`r`n%endOfCodeMarkKW%, `r`n`tLINK_LEXER(lmAHK1);`r`n`r`n%endOfCodeMarkKW%

; Keep just in case
FileMove %scKWFile%, %scKWFile%_OLD
; And put out version...
FileAppend %source%, %scKWFile%

;!!! You must also add the LexAHK1.cxx file to your project (depending on your compiler/IDE).
MsgBox 64, AddLexAHK1, Done!


I updated the SciTE4AHK.zip file with this new script, latest changes, build files for Scintilla and SciTE+Lua.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2010, 3:35 pm 
Offline
User avatar

Joined: October 18th, 2008, 2:09 pm
Posts: 429
is there a chance anyone can update the SciLexer.dll to the latest version?
That's version 2.03, which is quite a bit more recent than 1.77 :S


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2010, 11:10 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Actually, if you have read the thread (long!), you should have seen my updates.
Your remark is useful, though, I modified the initial post to point to the file with updates and boldly removed the DLL file I pointed to at the time.
Thanks.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2010, 12:07 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
I have fixed some problems with folding and added AutoHotkey_L object syntax support to this lexer.
Code:
// Scintilla source code edit control
/** @file LexAHK1.cxx
 ** Lexer for AutoHotkey, simplified version
 ** Written by Philippe Lhoste (PhiLho)
 ** Some hacks by fincs to:
 **  - Support AutoHotkey_L object syntax.
 **  - Fix folding.
 **/
// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

#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"


static inline bool IsAWordChar(const int ch) {
   return ch >= 0x80 || isalnum(ch) ||
         ch == '_' || ch == '$' || //ch == '[' || ch == ']' || // fincs-edit
         ch == '#' || ch == '@' || ch == '?';
}

// Expression operator
// ( ) + - * ** / // ! ~ ^ & << >> . < > <= >= = == != <> && ||
static inline bool IsExpOperator(const int ch) {
   if (ch >= 0x80 || isalnum(ch))   // Fast exit
      return false;
   return ch == '+' || ch == '-' || ch == '*' || ch == '/' ||
         ch == '(' || ch == ')' || ch == '.' ||
         ch == '=' || ch == '<' || ch == '>' ||
         ch == '&' || ch == '|' || ch == '^' || ch == '~' || ch == '!'
         || ch == '[' || ch == ']'; // fincs-edit
}

static void HighlightKeyword(
   char currentWord[],
   StyleContext &sc,
   WordList *keywordlists[],
   Accessor &styler) {

   WordList &controlFlow = *keywordlists[0];
   WordList &commands = *keywordlists[1];
   WordList &functions = *keywordlists[2];
   WordList &directives = *keywordlists[3];
   WordList &keysButtons = *keywordlists[4];
   WordList &variables = *keywordlists[5];
   WordList &specialParams = *keywordlists[6];
   WordList &userDefined = *keywordlists[7];

   if (controlFlow.InList(currentWord)) {
      sc.ChangeState(SCE_AHK_WORD_CF);
   } else if (commands.InList(currentWord)) {
      sc.ChangeState(SCE_AHK_WORD_CMD);
   } else if (functions.InList(currentWord)) {
      sc.ChangeState(SCE_AHK_WORD_FN);
   }  else if (currentWord[0] == '#' && directives.InList(currentWord + 1)) {
      sc.ChangeState(SCE_AHK_WORD_DIR);
   } else if (keysButtons.InList(currentWord)) {
      sc.ChangeState(SCE_AHK_WORD_KB);
   } else if (variables.InList(currentWord)) {
      sc.ChangeState(SCE_AHK_WORD_VAR);
   } else if (specialParams.InList(currentWord)) {
      sc.ChangeState(SCE_AHK_WORD_SP);
   } else if (userDefined.InList(currentWord)) {
      sc.ChangeState(SCE_AHK_WORD_UD);
   } else {
      sc.ChangeState(SCE_AHK_DEFAULT);
   }
}

static void ColouriseAHK1Doc(
   unsigned int startPos,
   int length,
   int initStyle,
   WordList *keywordlists[],
   Accessor &styler) {

   WordList &keysButtons = *keywordlists[4];
   WordList &variables = *keywordlists[5];
   char currentWord[256];

   // Do not leak onto next line
   if (initStyle != SCE_AHK_COMMENTBLOCK &&
         initStyle != SCE_AHK_STRING) {
      initStyle = SCE_AHK_DEFAULT;
   }
   int currentState = initStyle;
   int nextState = -1;

   /* The AutoHotkey syntax is heavily context-dependent.
   For example, for each command, the lexer knows if parameter #n
   is a string, a variable, a number, an expression, etc.
   I won't go this far, but I will try to handle most regular cases.
   */
   // True if in a continuation section
   bool bContinuationSection = (initStyle == SCE_AHK_STRING);
   // Indicate if the lexer has seen only spaces since the start of the line
   bool bOnlySpaces = (!bContinuationSection);
   // Indicate if since the start of the line, lexer met only legal label chars
   bool bIsLabel = false;
   // Distinguish hotkeys from hotstring
   bool bIsHotkey = false;
   bool bIsHotstring = false;
   // In an expression
   bool bInExpression = false;
   // A quoted string in an expression (share state with continuation section string)
   bool bInExprString = false;
   // To accept A-F chars in a number
   bool bInHexNumber = false;

   StyleContext sc(startPos, length, initStyle, styler);

   for (; sc.More(); sc.Forward()) {
      if (nextState >= 0) {
         // I need to reset a state before checking new char
         sc.SetState(nextState);
         nextState = -1;
      }
      if (sc.state == SCE_AHK_SYNOPERATOR) {
         // Only one char (if two detected, we move Forward() anyway)
         sc.SetState(SCE_AHK_DEFAULT);
      }
      if (sc.atLineEnd && (bIsHotkey || bIsHotstring)) {
         // I make the hotkeys and hotstrings more visible
         // by changing the line end to LABEL style (if style uses eolfilled)
         bIsHotkey = bIsHotstring = false;
         sc.SetState(SCE_AHK_LABEL);
      }
      if (sc.atLineStart) {
         if (sc.state != SCE_AHK_COMMENTBLOCK &&
               !bContinuationSection) {
            // Prevent some styles from leaking back to previous line
            sc.SetState(SCE_AHK_DEFAULT);
         }
         bOnlySpaces = true;
         bIsLabel = false;
         bInExpression = false;   // I don't manage multiline expressions yet!
         bInHexNumber = false;
      }

      // Manage cases occuring in (almost) all states (not in comments)
      if (sc.state != SCE_AHK_COMMENTLINE &&
            sc.state != SCE_AHK_COMMENTBLOCK &&
            !IsASpace(sc.ch)) {
         if (sc.ch == '`') {
            // Backtick, escape sequence
            currentState = sc.state;
            sc.SetState(SCE_AHK_ESCAPE);
            sc.Forward();
            nextState = currentState;
            continue;
         }
         if (sc.ch == '%' && !bIsHotstring && !bInExprString &&
               sc.state != SCE_AHK_VARREF &&
               sc.state != SCE_AHK_VARREFKW &&
               sc.state != SCE_AHK_ERROR) {
            if (IsASpace(sc.chNext)) {
               if (sc.state == SCE_AHK_STRING) {
                  // Illegal unquoted character!
                  sc.SetState(SCE_AHK_ERROR);
               } else {
                  // % followed by a space is expression start
                  bInExpression = true;
               }
            } else {
               // Variable reference
               currentState = sc.state;
               sc.SetState(SCE_AHK_SYNOPERATOR);
               nextState = SCE_AHK_VARREF;
               continue;
            }
         }
         if (sc.state != SCE_AHK_STRING && !bInExpression) {
            // Management of labels, hotkeys, hotstrings and remapping

            // Check if the starting string is a label candidate
            if (bOnlySpaces &&
                  sc.ch != ',' && sc.ch != ';' && sc.ch != ':' &&
                  sc.ch != '%' && sc.ch != '`') {
               // A label cannot start with one of the above chars
               bIsLabel = true;
            }

            // The current state can be IDENTIFIER or DEFAULT,
            // depending if the label starts with a word char or not
            if (bIsLabel && sc.ch == ':' &&
                  (IsASpace(sc.chNext) || sc.atLineEnd)) {
               // ?l/a|b\e^l!:
               // Only ; comment should be allowed after
               sc.ChangeState(SCE_AHK_LABEL);
               sc.SetState(SCE_AHK_SYNOPERATOR);
               nextState = SCE_AHK_DEFAULT;
               continue;
            } else if (sc.Match(':', ':')) {
               if (bOnlySpaces) {
                  // Hotstring ::aa::Foo
                  bIsHotstring = true;
                  sc.SetState(SCE_AHK_SYNOPERATOR);
                  sc.Forward();
                  nextState = SCE_AHK_LABEL;
                  continue;
               }
               // Hotkey F2:: or remapping a::b
               bIsHotkey = true;
               // Check if it is a known key
               sc.GetCurrentLowered(currentWord, sizeof(currentWord));
               if (keysButtons.InList(currentWord)) {
                  sc.ChangeState(SCE_AHK_WORD_KB);
               }
               sc.SetState(SCE_AHK_SYNOPERATOR);
               sc.Forward();
               if (bIsHotstring) {
                  nextState = SCE_AHK_STRING;
               }
               continue;
            }
         }
      }
      // Check if the current string is still a label candidate
      // Labels are much more permissive than regular identifiers...
      if (bIsLabel &&
            (sc.ch == ',' || sc.ch == '%' || sc.ch == '`' || IsASpace(sc.ch))) {
         // Illegal character in a label
         bIsLabel = false;
      }

      // Determine if the current state should terminate.
      if (sc.state == SCE_AHK_COMMENTLINE) {
         if (sc.atLineEnd) {
            sc.SetState(SCE_AHK_DEFAULT);
         }
      } else if (sc.state == SCE_AHK_COMMENTBLOCK) {
         if (bOnlySpaces && sc.Match('*', '/')) {
            // End of comment at start of line (skipping white space)
            sc.Forward();
            sc.ForwardSetState(SCE_C_DEFAULT);
         }
      } else if (sc.state == SCE_AHK_EXPOPERATOR) {
         if (!IsExpOperator(sc.ch)) {
            sc.SetState(SCE_AHK_DEFAULT);
         }
      } else if (sc.state == SCE_AHK_STRING) {
         if (bContinuationSection) {
            if (bOnlySpaces && sc.ch == ')') {
               // End of continuation section
               bContinuationSection = false;
               sc.SetState(SCE_AHK_SYNOPERATOR);
            }
         } else if (bInExprString) {
            if (sc.ch == '\"') {
               if (sc.chNext == '\"') {
                  // In expression string, double quotes are doubled to escape them
                  sc.Forward();   // Skip it
               } else {
                  bInExprString = false;
                  sc.ForwardSetState(SCE_AHK_DEFAULT);
               }
            } else if (sc.atLineEnd) {
               sc.ChangeState(SCE_AHK_ERROR);
            }
         } else {
            if (sc.ch == ';' && IsASpace(sc.chPrev)) {
               // Line comments after code must be preceded by a space
               sc.SetState(SCE_AHK_COMMENTLINE);
            }
         }
      } else if (sc.state == SCE_AHK_NUMBER) {
         if (bInHexNumber) {
            if (!IsADigit(sc.ch, 16)) {
               bInHexNumber = false;
               sc.SetState(SCE_AHK_DEFAULT);
            }
         } else if (!(IsADigit(sc.ch) || sc.ch == '.')) {
            sc.SetState(SCE_AHK_DEFAULT);
         }
      } else if (sc.state == SCE_AHK_IDENTIFIER) {
         if (!IsAWordChar(sc.ch)) {
            sc.GetCurrentLowered(currentWord, sizeof(currentWord));
            HighlightKeyword(currentWord, sc, keywordlists, styler);
            if (strcmp(currentWord, "if") == 0) {
               bInExpression = true;
            }
            sc.SetState(SCE_AHK_DEFAULT);
         }
      } else if (sc.state == SCE_AHK_VARREF) {
         if (sc.ch == '%') {
            // End of variable reference
            sc.GetCurrentLowered(currentWord, sizeof(currentWord));
            if (variables.InList(currentWord)) {
               sc.ChangeState(SCE_AHK_VARREFKW);
            }
            sc.SetState(SCE_AHK_SYNOPERATOR);
            nextState = currentState;
            continue;
         } else if (!IsAWordChar(sc.ch)) {
            // Oops! Probably no terminating %
            sc.ChangeState(SCE_AHK_ERROR);
         }
      } else if (sc.state == SCE_AHK_LABEL) {
         // Hotstring -- modifier or trigger string :*:aa::Foo or ::aa::Foo
         if (sc.ch == ':') {
            sc.SetState(SCE_AHK_SYNOPERATOR);
            if (sc.chNext == ':') {
               sc.Forward();
            }
            nextState = SCE_AHK_LABEL;
            continue;
         }
      }

      // Determine if a new state should be entered
      if (sc.state == SCE_AHK_DEFAULT) {
         if (sc.ch == ';' &&
               (bOnlySpaces || IsASpace(sc.chPrev))) {
            // Line comments are alone on the line or are preceded by a space
            sc.SetState(SCE_AHK_COMMENTLINE);
         } else if (bOnlySpaces && sc.Match('/', '*')) {
            // Comment at start of line (skipping white space)
            sc.SetState(SCE_AHK_COMMENTBLOCK);
            sc.Forward();
         } else if (sc.ch == '{' || sc.ch == '}') {
            // Code block or special key {Enter}
            sc.SetState(SCE_AHK_SYNOPERATOR);
         } else if (bOnlySpaces && sc.ch == '(') {
            // Continuation section
            bContinuationSection = true;
            sc.SetState(SCE_AHK_SYNOPERATOR);
            nextState = SCE_AHK_STRING;   // !!! Can be an expression!
         } else if (sc.Match(':', '=') ||
               sc.Match('+', '=') ||
               sc.Match('-', '=') ||
               sc.Match('/', '=') ||
               sc.Match('*', '=')) {
            // Expression assignment
            bInExpression = true;
            sc.SetState(SCE_AHK_SYNOPERATOR);
            sc.Forward();
            nextState = SCE_AHK_DEFAULT;
         } else if (IsExpOperator(sc.ch)) {
            sc.SetState(SCE_AHK_EXPOPERATOR);
         } else if (sc.ch == '\"') {
            bInExprString = true;
            sc.SetState(SCE_AHK_STRING);
         } else if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) {
            // Hexa, skip forward as we don't accept any other alpha char (beside A-F) inside
            bInHexNumber = true;
            sc.SetState(SCE_AHK_NUMBER);
            sc.Forward(2);
         } else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) {
            sc.SetState(SCE_AHK_NUMBER);
         } else if (IsAWordChar(sc.ch)) {
            sc.SetState(SCE_AHK_IDENTIFIER);
         } else if (sc.ch == ',') {
            sc.SetState(SCE_AHK_SYNOPERATOR);
            nextState = SCE_AHK_DEFAULT;
         } else if (sc.ch == ':') {
            if (bOnlySpaces) {
               // Start of hotstring :*:foo::Stuff or ::btw::Stuff
               bIsHotstring = true;
               sc.SetState(SCE_AHK_SYNOPERATOR);
               if (sc.chNext == ':') {
                  sc.Forward();
               }
               nextState = SCE_AHK_LABEL;
            }
         } else if (IsAWordChar(sc.ch)) {
            sc.SetState(SCE_AHK_IDENTIFIER);
         }
      }
      if (!IsASpace(sc.ch)) {
         bOnlySpaces = false;
      }
   }
   // End of file: complete any pending changeState
   if (sc.state == SCE_AHK_IDENTIFIER) {
      sc.GetCurrentLowered(currentWord, sizeof(currentWord));
      HighlightKeyword(currentWord, sc, keywordlists, styler);
   } else if (sc.state == SCE_AHK_STRING && bInExprString) {
      sc.ChangeState(SCE_AHK_ERROR);
   } else if (sc.state == SCE_AHK_VARREF) {
      sc.ChangeState(SCE_AHK_ERROR);
   }
   sc.Complete();
}

static void FoldAHK1Doc(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;
   bool bOnlySpaces = true;
   int lineCurrent = styler.GetLine(startPos);
   int levelCurrent = SC_FOLDLEVELBASE;
   if (lineCurrent > 0) {
      levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
   }
   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 && style == SCE_AHK_COMMENTBLOCK) {
         if (stylePrev != SCE_AHK_COMMENTBLOCK) {
            levelNext++;
         } else if ((styleNext != SCE_AHK_COMMENTBLOCK) && !atEOL) {
            // Comments don't end at end of line and the next character may be unstyled.
            levelNext--;
         }
      }
      if (style == SCE_AHK_SYNOPERATOR) {
         if (ch == '(' || ch == '{') {
            levelNext++;
         } else if (ch == ')' || ch == '}') {
            levelNext--;
         }
      }
      if (atEOL || (i == endPos-1)) {
         int level = levelCurrent | (levelNext << 16);
         if (bOnlySpaces && foldCompact) {
            // Empty line
            level |= SC_FOLDLEVELWHITEFLAG;
         }
         if (levelCurrent < levelNext) {
            level |= SC_FOLDLEVELHEADERFLAG;
         }
         if (level != styler.LevelAt(lineCurrent)) {
            styler.SetLevel(lineCurrent, level);
         }
         lineCurrent++;
         levelCurrent = levelNext;
         if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
            // There is an empty line at end of file so give it same level and empty
            styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
         }
         bOnlySpaces = true;
      }
      if (!isspacechar(ch)) {
         bOnlySpaces = false;
      }
   }
}

static const char * const ahkWordListDesc[] = {
   "Flow of control",
   "Commands",
   "Functions",
   "Directives",
   "Keys & buttons",
   "Variables",
   "Special Parameters (keywords)",
   "User defined",
   0
};

LexerModule lmAHK1(SCLEX_AHK1, ColouriseAHK1Doc, "ahk1", FoldAHK1Doc, ahkWordListDesc);

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject: v.2.12
PostPosted: June 2nd, 2010, 1:32 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
A little bump for SciTE 2.12.
Note this version integrates support for lexers written in Lua!

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Last edited by PhiLho on February 4th, 2011, 9:59 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 2nd, 2010, 4:03 pm 
Offline

Joined: February 19th, 2010, 8:07 pm
Posts: 614
I am not sure If you guys finally made it for Notepad++ but reading around I dont see any sign of that, so let me link to my post...

http://www.autohotkey.com/forum/viewtop ... 842#359842

I imported PhiLo's lexer in to Notepad++ as a plugin. You only need to copy the files in to your plugins directory and you are totally done...

No more userDefined.xml editing which has some annoying limitations...


Report this post
Top
 Profile  
Reply with quote  
 Post subject: v.2.21
PostPosted: September 4th, 2010, 9:56 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Bump for 2.21. I had to update a bit the AHK script as the lexer source files now go to a specific directory (at least!).
Of course, I updated also the vcproj files for those wanting to compile themselves Scintilla (eg. to include fincs' changes, which I haven't looked into).
Note: the new version has an interesting Find/Replace strip if you activate the right option.

2.2x series has improved the lexer API, it should be easier to handle peculiarities of AHK. But I admit I have lost the motivation to rewrite the lexer...
Just learning Scala now, after JavaFX and Processing... :)

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Last edited by PhiLho on February 4th, 2011, 9:58 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: v.2.24
PostPosted: February 4th, 2011, 9:57 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Bump for 2.24. As usual, see the first post for the download (binary of SciTE+official lexer with AHK (and Scala!) unofficial lexers, source code and VS projects, etc.) at the usual place.

This version has, among other things, a regex search improvement: you can use ? as {0,1} and to change * and + to be non-greedy.
Another nice (older) feature is the capability to drag'n'drop tabs to reorder buffers.

Unrelated note: I updated my regex tutorial with a better (hopefully) explanation of lookahead and lookbehind features.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2011, 6:46 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
S4AHK update: I've just merged 2.24.

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 5:27 pm 
Offline
User avatar

Joined: February 28th, 2011, 7:28 pm
Posts: 625
Location: Germany
Hi,
I'm having a little problem:

The context:
I'm working on another project that uses scintilla control. I want to support AHK syntax highlighting there,
but also any other language for that a lexer was written. So I thought of dynamically using those functions to load a lexer library. If you know another way, please let me know.
I asked fincs for the dll used in SciTe4AutoHotkey, and was told that it uses your one.

The actual problem:
My problem is that I don't really understand what your Lexer is:
It is not a lexer DLL that can be used with the functions documented here, is it?
It seems to be a replacement for SciLexer.dll instead, right?
If so, would I be able to change it to a DLL that can be used with those functions? How?

PhilLho wrote:
If all goes well, it will become officially part of the Scintilla package.
Did this ever happen?

Btw: I just saw there's a new scintilla version today.

Regards
maul.esel

_________________
RECOMMENDED: AutoHotkey_L
Image
github - ImportTypeLib
Win7 HP SP1 32bit | AHK_L U 32bit


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 6:25 pm 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
@maul.esel : I am not the OP, but I was working on a Scintilla edit control library with maestrith

Here is the demo, just see if this is what you were looking for.
Download

The SciLexerAHK.dll is the same of this thread. You can load any other SciLexer.dll alongside, or you can just copy LexAHK1.cxx to the Lexers folder of Scintilla source and run AddLexAHK1.ahk to add the AHK lexer. Then you can compile it (as described in the README file of Scintilla source to get your custom SciLexer.dll

_________________
If i've seen further it is by standing on the shoulders of giants

my site | ~shajul | WYSIWYG BBCode Editor


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2011, 7:37 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
maul.esel wrote:
It is not a lexer DLL that can be used with the functions documented here, is it?
It seems to be a replacement for SciLexer.dll instead, right?
If so, would I be able to change it to a DLL that can be used with those functions? How?

Yes, it is a replacement for SciLexer.dll, a strict superset.
And SciLexer.dll is a strict superset of Scintilla.dll, ie. it implements all these "functions" (which are really Windows messages with parameters).
So, my DLL gives access to all these features.

And no, LexAHK isn't part of Scintilla, I admit I hadn't time (or motivation) to improve or rewrite the lexer to a satisfying state. Today, I would try and use the new facilities to write lexers.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2011, 8:57 pm 
Offline
User avatar

Joined: February 28th, 2011, 7:28 pm
Posts: 625
Location: Germany
PhilLho wrote:
So, my DLL gives access to all these features.
Actually I meant it couldn't be loaded itself with the SCI_Lexer functions (especially SCI_LoadLexerLibrary + SCI_SetLexerLanguage) I linked.

_________________
RECOMMENDED: AutoHotkey_L
Image
github - ImportTypeLib
Win7 HP SP1 32bit | AHK_L U 32bit


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 31st, 2011, 5:00 pm 
Offline
User avatar

Joined: February 28th, 2011, 7:28 pm
Posts: 625
Location: Germany
Just as a question: Would it be possible to compile your lexer to a *.dll that
  • only contains the lexer
  • and that can be loaded with SCI_LoadLexerLibrary?

If so, would you tell me how to do so?

Gruß
maul.esel

_________________
RECOMMENDED: AutoHotkey_L
Image
github - ImportTypeLib
Win7 HP SP1 32bit | AHK_L U 32bit


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 123 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group