Syntax highligher for Notepad++ (FB0.91)

Post your FreeBASIC tips and tricks here. Please don’t post your code without including an explanation.
dstein
Posts: 7
Joined: Sep 07, 2014 4:23

Syntax highligher for Notepad++ (FB0.91)

Postby dstein » Sep 11, 2014 18:28

I've cobbled together a syntax highlighter for Notepad++ that is FB0.91-ready. I'm NOT a UDL wizard, and I have done only the most cursory testing on this - but I believe this will serve as a good starting point for interested parties.

The bulk of the keywords are listed in groups, reflecting the categories found on the documentation wiki (i.e. all the string functions are grouped, all the math functions are grouped, etc). This should make it easier for those wanting to break groups out into their own formats to quickly grab all related keywords in one cut/paste operation.

To use, save the code below as FreeBASIC.xml, then open Notepad++, select Language->Define Your Language->Import... and select the XML file.

[code=xml file=FreeBASIC.xml]<NotepadPlus>
<UserLang name="FreeBASIC" ext=" .bas,.bi" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">03/&apos; 04&apos;/ 00&apos; 01 02</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
<Keywords name="Numbers, extras1"></Keywords>
<Keywords name="Numbers, extras2"></Keywords>
<Keywords name="Numbers, suffix1"></Keywords>
<Keywords name="Numbers, suffix2"></Keywords>
<Keywords name="Numbers, range"></Keywords>
<Keywords name="Operators1">-&gt; = &amp;= += -= *= /= \= ^= MOD= AND= EQV= IMP= OR= XOR= SHL= SHR= + - * / \ ^ MOD SHL SHR @ .-&gt; &amp; &lt;= =&gt; &lt; &gt; ( ) [ ]</Keywords>
<Keywords name="Operators2"></Keywords>
<Keywords name="Folders in code1, open"></Keywords>
<Keywords name="Folders in code1, middle"></Keywords>
<Keywords name="Folders in code1, close"></Keywords>
<Keywords name="Folders in code2, open">enum type function sub property</Keywords>
<Keywords name="Folders in code2, middle">&quot;declare function&quot; &quot;declare sub&quot;</Keywords>
<Keywords name="Folders in code2, close">&quot;end enum&quot; &quot;end type&quot; &quot;end function&quot; &quot;end sub&quot; &quot;end property&quot;</Keywords>
<Keywords name="Folders in comment, open"></Keywords>
<Keywords name="Folders in comment, middle"></Keywords>
<Keywords name="Folders in comment, close"></Keywords>
<Keywords name="Keywords1">erase lbound preserve redim ubound&#x000D;&#x000A;bit bitreset bitset hibyte hiword lobyte loword&#x000D;&#x000A;and andalso eqv imp not or orelse xor&#x000D;&#x000A;rem&#x000D;&#x000A;defbyte defdbl defint deflng deflongint defshort defsng defstr defubyte defuint defulongint defushort&#x000D;&#x000A;option base byval dynamic explicit gosub nogosub nokeyword private static&#x000D;&#x000A;beep csrlin locate open cons err pipe scrn pos print using spc tab width write&#x000D;&#x000A;asc bin chr cvd cvi cvl cvlongint cvs cvshort format hex mkd mki mkl mklongint mks mkshort oct str val valint vallng valuint valulng wbin wchr whex woct wstr&#x000D;&#x000A;as class dim enum extends implements object private: protected: public: scope shared type union var with&#x000D;&#x000A;date dateadd datediff datepart dateserial datevalue day hour isdate&#x000D;&#x000A;minute month monthname now second setdate settime time timer timeserial timevalue weekday weekdayname year&#x000D;&#x000A;access append binary bload bsave close encoding eof freefile get input input$ &quot;line input&quot; loc lock lof open output &quot;print #&quot; &quot;put #&quot; random read&#x000D;&#x000A;&quot;read write&quot; reset seek unlock &quot;write #&quot;&#x000D;&#x000A;case continue do else elseif &quot;end if&quot; endif exit for gosub goto if iif is loop next on return select sleep step then until wend while&#x000D;&#x000A;add alpha circle cls color custom draw &quot;draw string&quot; flip get imageconvertrow imagecreate imagecreate imagedestroy imageinfo line paint palette pcopy pmap point pointcoord preset pset put rgb rgba screen screencontrol screencopy screenevent screenglproc screeninfo screenlist screenlock screenptr screenres screenset screensync screenunlock trans view window&#x000D;&#x000A;inp lpos lprint lpt open com out wait&#x000D;&#x000A;abs acos asin atan2 atn cos exp fix frac int log randomize rnd sgn shl shr sin sqr tan&#x000D;&#x000A;peek poke allocate callocate clear deallocate delete field fre new reallocate&#x000D;&#x000A;asm data let offsetof option restore sizeof swap to typeof&#x000D;&#x000A;common dylibfree dylibload dylibsymbol end exterrn export extern import namespace private public using&#x000D;&#x000A;procptr strptr varptr&#x000D;&#x000A;abstract alias base byref byval call cdecl constructor declare destructor function lib naked operator overload override pascal property protected static stdcall sub this va_arg va_first va_next virtual&#x000D;&#x000A;sadd instr instrrev lcase left len lset ltrim mid right rset rtrim space trim ucase wspace&#x000D;&#x000A;condbroadcast condcreate conddestroy condsignal condwait mutexcreate mutexdestroy mutexlock mutexunlock threadcall&#x000D;&#x000A;threadcreate threaddetach threadwait&#x000D;&#x000A;cast cbyte cdbl cint clng clngint cptr cshort csign csng cubyte cuint culng culngint cunsg cushort &#x000D;&#x000A;getjoystick getkey getmouse inkey multikey setmouse stick strig winput&#x000D;&#x000A;&#x000D;&#x000A;</Keywords>
<Keywords name="Keywords2">any&#x000D;&#x000A;byte&#x000D;&#x000A;const&#x000D;&#x000A;double&#x000D;&#x000A;integer&#x000D;&#x000A;long&#x000D;&#x000A;longint&#x000D;&#x000A;pointer&#x000D;&#x000A;ptr&#x000D;&#x000A;short&#x000D;&#x000A;single&#x000D;&#x000A;string&#x000D;&#x000A;ubyte&#x000D;&#x000A;uinteger&#x000D;&#x000A;ulong&#x000D;&#x000A;ulongint&#x000D;&#x000A;unsigned&#x000D;&#x000A;ushort&#x000D;&#x000A;wstring&#x000D;&#x000A;zstring</Keywords>
<Keywords name="Keywords3">#assert&#x000D;&#x000A;#define&#x000D;&#x000A;#else&#x000D;&#x000A;#elseif&#x000D;&#x000A;#endif&#x000D;&#x000A;#endmacro&#x000D;&#x000A;#error&#x000D;&#x000A;#if&#x000D;&#x000A;#ifdef&#x000D;&#x000A;#ifndef&#x000D;&#x000A;#inclib&#x000D;&#x000A;#include&#x000D;&#x000A;#lang&#x000D;&#x000A;#libpath&#x000D;&#x000A;#line&#x000D;&#x000A;#macro&#x000D;&#x000A;#pragma&#x000D;&#x000A;#print&#x000D;&#x000A;#undef&#x000D;&#x000A;defined&#x000D;&#x000A;once&#x000D;&#x000A;</Keywords>
<Keywords name="Keywords4">null true false</Keywords>
<Keywords name="Keywords5">__FB_VERSION__&#x000D;&#x000A;__FB_BUILD_DATE__&#x000D;&#x000A;__FB_VER_MAJOR__&#x000D;&#x000A;__FB_VER_MINOR__&#x000D;&#x000A;__FB_VER_PATCH__&#x000D;&#x000A;__FB_SIGNATURE__&#x000D;&#x000A;__FB_MT__&#x000D;&#x000A;__FILE__&#x000D;&#x000A;__FILE_NQ__&#x000D;&#x000A;__FUNCTION__&#x000D;&#x000A;__FUNCTION_NQ__&#x000D;&#x000A;__LINE__&#x000D;&#x000A;__DATE__&#x000D;&#x000A;__DATE_ISO__&#x000D;&#x000A;__TIME__&#x000D;&#x000A;__PATH__&#x000D;&#x000A;__FB_OPTION_BYVAL__&#x000D;&#x000A;__FB_OPTION_DYNAMIC__&#x000D;&#x000A;__FB_OPTION_ESCAPE__&#x000D;&#x000A;__FB_OPTION_EXPLICIT__&#x000D;&#x000A;__FB_OPTION_PRIVATE__&#x000D;&#x000A;__FB_OPTION_GOSUB__&#x000D;&#x000A;__FB_OUT_EXE__&#x000D;&#x000A;__FB_OUT_LIB__&#x000D;&#x000A;__FB_OUT_DLL__&#x000D;&#x000A;__FB_OUT_OBJ__&#x000D;&#x000A;__FB_DEBUG__&#x000D;&#x000A;__FB_ERR__&#x000D;&#x000A;__FB_LANG__&#x000D;&#x000A;__FB_BACKEND__&#x000D;&#x000A;__FB_FPU__&#x000D;&#x000A;__FB_FPMODE__&#x000D;&#x000A;__FB_GCC__&#x000D;&#x000A;__FB_ARGC__&#x000D;&#x000A;__FB_ARGV__&#x000D;&#x000A;__FB_BIGENDIAN__&#x000D;&#x000A;__FB_CYGWIN__&#x000D;&#x000A;__FB_DARWIN__&#x000D;&#x000A;__FB_DOS__&#x000D;&#x000A;__FB_FREEBSD__&#x000D;&#x000A;__FB_LINUX__&#x000D;&#x000A;__FB_MAIN__&#x000D;&#x000A;__FB_NETBSD__&#x000D;&#x000A;__FB_OPENBSD__&#x000D;&#x000A;__FB_PCOS__&#x000D;&#x000A;__FB_SSE__&#x000D;&#x000A;__FB_UNIX__&#x000D;&#x000A;__FB_VECTORIZE__&#x000D;&#x000A;__FB_WIN32__&#x000D;&#x000A;__FB_XBOX__</Keywords>
<Keywords name="Keywords6">assert assertwarn stop &#x000D;&#x000A;erfn err error local &quot;on error&quot; resume &quot;resume next&quot;</Keywords>
<Keywords name="Keywords7">chain chdir command curdir dir end environ exec exepath fileattr filecopy filedatetime fileexists filelen&#x000D;&#x000A;isredirected kill mkdir name rmdir run setenviron shell system windowtitle</Keywords>
<Keywords name="Keywords8"></Keywords>
<Keywords name="Delimiters">00 01 02 03[ 04 05] 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
</KeywordLists>
<Styles>
<WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="2" nesting="0" />
<WordsStyle name="LINE COMMENTS" fgColor="008000" bgColor="FFFFFF" fontName="" fontStyle="2" nesting="0" />
<WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS1" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS2" fgColor="8000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS3" fgColor="808040" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS4" fgColor="8080FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS5" fgColor="FF0080" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS6" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
<WordsStyle name="KEYWORDS7" fgColor="B03022" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="OPERATORS" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN CODE2" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS1" fgColor="FF00FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS2" fgColor="FF00FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS4" fgColor="0000FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
<WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
</Styles>
</UserLang>
</NotepadPlus>
[/code]
dkl
Site Admin
Posts: 3212
Joined: Jul 28, 2005 14:45
Location: Germany

Re: Syntax highligher for Notepad++ (FB0.91)

Postby dkl » Sep 11, 2014 21:02

Hi, that's cool. I'm not on Windows that much anymore but it does happen, and I'm using Notepad++ there. And this is much better than the VB highlighting.

I had to import the XML and then restart Notepad++, after which "FreeBASIC" appeared at the bottom of the Language menu above "User defined". Selecting it for open .bas files worked fine, but it would not automatically highlight newly opened bas/bi files.

Eventually I figured out where the xml files for other languages were, and saw that they specify extensions without dot and separated by space instead of comma. After the following adjustment I got it working:

Code: Select all

-    <UserLang name="FreeBASIC" ext=" .bas,.bi" udlVersion="2.1">
+    <UserLang name="FreeBASIC" ext="bas bi" udlVersion="2.1">
Carlos Herrera
Posts: 82
Joined: Nov 28, 2011 13:29
Location: Dictatorship

Re: Syntax highligher for Notepad++ (FB0.91)

Postby Carlos Herrera » Oct 26, 2014 9:31

That's cool indeed, thanks. I wonder if you (or maybe somebody else)
have succeed in preparing a Freebasic entry in the functionList.xml
parser file for npp? I am not familiar with xml syntax, so I have
difficulties in following npp wiki instructions out.
Regards,
Carlos
dstein
Posts: 7
Joined: Sep 07, 2014 4:23

Re: Syntax highligher for Notepad++ (FB0.91)

Postby dstein » Oct 26, 2014 23:01

I've never tried messing about with functionList.xml but sounded like an interesting challenge, made even more so by my almost total lack of real understanding of REs. After a couple hours of messing about I've got something that appears to show all Subs and Functions in the Function List. If it should be showing more details (such as function params and/or links to structures) let me know and I'll keep playing. If anyone has a specific case that should show up but doesn't please post sample code that fails to render correctly so I can try to reproduce and fix.

An implementation note: I updated %APPDATA%\Notepad++\functionList.xml. You may also have a copy of this file in c:\program files\notepad++ (or c:\program files (x86)\notepad++). If you have two copies, the one in C:\Program Files\<blah> may be NEWER than your personal copy. Apparently, later versions of npp updated this version but left your private copy untouched. The core version introduced new language support which might be MASKED by your private copy. If you haven't previously updated your own copy, suggest you first copy from Program Files over your %APPDATA%\Notepad++ copy, and then edit your copy.

You have to make updates to two places in functionList.xml:
1. In the [associationMap] section of the file, near the top, add a line to associate the FreeBASIC UDL with the new freebasic function parser:

Code: Select all

      
                     <association userDefinedLangName="FreeBASIC" id="freebasic"/>


2. In the [parsers] section of the file, add these lines:

Code: Select all

         <parser id="freebasic" displayName="FreeBASIC" commentExpr="(^[ \t]*'.*?$|/'.*?./)">
            <function
               mainExpr="(sub|function)[ \t]+[a-z0-9_]*"
               displayMode="$functionName">
               <functionName>
                  <nameExpr expr="(sub|function)[ \t]+[a-z0-9_]+"/>
               </functionName>
            </function>
         </parser>
Carlos Herrera
Posts: 82
Joined: Nov 28, 2011 13:29
Location: Dictatorship

Re: Syntax highligher for Notepad++ (FB0.91)

Postby Carlos Herrera » Oct 28, 2014 14:41

dstein, thank you very much indeed. It almost works.
The only problem is that the procedure name appears
2 times on a list. First occurrence directs to the location of
"Declare Sub <name>" statement, second to the procedure itself.
There are also empty lines.
Please find below the xml file for visual basic (VB) procedure list,
which I found at the notepad users forum. It works also for FreeBASIC
and does not create double entries, but I have tested it
only for a few simple programs.

Code: Select all

<!-- Menno's ++ -->
            <parser
              id="vb_function"
              displayName="Visual Basic (.NET|Script|for Applications)" 
              commentExpr="(?m:((?&lt;=&apos;).*?$)|((?i:REM)([\t ].*?)?$))">
            <classRange
                mainExpr="(?s:(?&lt;SCOPE&gt;(?i:CLASS|TYPE)).*?(?i:END[\t ]\k&lt;SCOPE&gt;))"
                displayMode="node" >
              <className>
                <nameExpr expr="(?i:CLASS|TYPE)[\t ]+(?:[A-Za-z_][\w]*\b)(?:.*?[\r\n])" />
                <nameExpr expr="[\t ]+(?:[A-Za-z_][\w]*\b)" />
                <nameExpr expr="[A-Za-z_][\w]*" />
              </className>
              <function
                  mainExpr="(?m:^[\t ]*(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|SHARED|SHADOWS|OVERRIDABLE|OVERRIDES|READONLY|WRITEONLY)[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$))" >
                <functionName>
                  <funcNameExpr expr="(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:STATIC[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
                  <funcNameExpr expr="(?i:(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
                  <funcNameExpr expr="(?i:(?:GET|LET|SET)[\t ]+)?[A-Za-z_][\w]*(?=[\t ]*\()"/>
                </functionName>
              </function>
            </classRange>
            <function
                mainExpr="^[\t ]*(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|(?:DECLARE(?:[\t ]+(ANSI|UNICODE|AUTO))?))[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"
                displayMode="$functionName">
              <functionName>
              <nameExpr expr="(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|(?:DECLARE(?:[\t ]+(?:ANSI|UNICODE|AUTO))?))[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
                <nameExpr expr="(?i:(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
                <nameExpr expr="(?i:(?:GET|LET|SET)[\t ]+)?[A-Za-z_][\w]*(?i:[\t ]+(LIB|ALIAS)[\t ]+[\w&quot;\.]+)*(?=[\t ]*\()"/>
              </functionName>
            </function>
         </parser>
           
            <parser id="freebasic" displayName="FreeBASIC" commentExpr="(^[ \t]*'.*?$|/'.*?./)">
                <function
                    mainExpr="(sub|function)[ \t]+[a-z0-9_]*"
                    displayMode="$functionName">
                    <functionName>
                        <nameExpr expr="(sub|function)[ \t]+[a-z0-9_]+"/>
                    </functionName>
                </function>
            </parser>


Regards,
Carlos
Carlos Herrera
Posts: 82
Joined: Nov 28, 2011 13:29
Location: Dictatorship

Re: Syntax highligher for Notepad++ (FB0.91)

Postby Carlos Herrera » Oct 28, 2014 19:36

Correction: I made a mistake.
Both versions generate double entries,
one for the procedure second for the procedure declaration,
if they are in the same source file.
It is expected since function list should work
also for *.bi files.
Regards,
Carlos
dstein
Posts: 7
Joined: Sep 07, 2014 4:23

Re: Syntax highligher for Notepad++ (FB0.91)

Postby dstein » Oct 28, 2014 23:43

In my limited experience (all 2 hours of playing around!) the blank entries indicate some problem with one of the regular expressions. I'll take a look at the VB parser you found - I'm sure I can learn a lot from the REs in use there.

Are you able to narrow down what section of your source code resulted in a blank line in the function list?
frisian
Posts: 249
Joined: Oct 08, 2009 17:25

Re: Syntax highligher for Notepad++ (FB0.91)

Postby frisian » Nov 01, 2014 22:19

dstein

You have the word "REM" listed as a keyword but it belongs in the tab comments & numbers it's from the early days of Basic. When it was at the beginning of a line the rest of that line was ignored.

Comments & Rem
Lothar Schirm
Posts: 333
Joined: Sep 28, 2013 15:08
Location: Bavaria, Germany

Re: Syntax highligher for Notepad++ (FB0.91)

Postby Lothar Schirm » Nov 02, 2014 18:44

dstein,

just a curious question: What is your motivation to use Notepad++ instead of Geany? In Geany you can directly compile and run your code (with up to three preselectable compiler options), and you have a browser for functions and variables.
Aquarius
Posts: 88
Joined: Jun 27, 2005 19:08

Re: Syntax highligher for Notepad++ (FB0.91)

Postby Aquarius » Nov 02, 2014 23:31

Notepad++ can do that too.
dstein
Posts: 7
Joined: Sep 07, 2014 4:23

Re: Syntax highligher for Notepad++ (FB0.91)

Postby dstein » Nov 03, 2014 14:43

Lothar - I don't use npp [for FB purposes]. I decided to build the syntax highlighter and then the function list stuff purely for "fun".

Truth be told, I don't really use FB for anything at the moment. BASIC programming was something I did for fun in my youth 35 years ago - first GW BASIC with my school's NorthStar computer, then later CBM BASIC with my own C64 - and right now FB and this forum are allowing me to relive some of those memories vicariously. Still trying to decide whether I have time to once again become a hobbyist writer of games!
Lothar Schirm
Posts: 333
Joined: Sep 28, 2013 15:08
Location: Bavaria, Germany

Re: Syntax highligher for Notepad++ (FB0.91)

Postby Lothar Schirm » Nov 05, 2014 16:22

Aquarius wrote:Notepad++ can do that too.


I have installed Notepad++ and the syntax highligher for FreeBasic, but I can not see how I can compile and run the code. When I select "Run" in the menu, a friendly window opens and asks me for the program to run. So I think that Notepad++ is not an IDE like Geany, but only an editor?
Roland Chastain
Posts: 948
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: Syntax highligher for Notepad++ (FB0.91)

Postby Roland Chastain » Nov 22, 2014 10:47

Lothar Schirm wrote:
Aquarius wrote:Notepad++ can do that too.


I have installed Notepad++ and the syntax highligher for FreeBasic, but I can not see how I can compile and run the code. When I select "Run" in the menu, a friendly window opens and asks me for the program to run. So I think that Notepad++ is not an IDE like Geany, but only an editor?


Hello! To compile with Notepad++, you have to install a plugin named NppExec.

npp-plugins
Lothar Schirm
Posts: 333
Joined: Sep 28, 2013 15:08
Location: Bavaria, Germany

Re: Syntax highligher for Notepad++ (FB0.91)

Postby Lothar Schirm » Nov 26, 2014 11:20

Thank you, but I stay with Geany.
SARG
Posts: 1157
Joined: May 27, 2005 7:15
Location: FRANCE

Help with regular expressions for Notepad++

Postby SARG » Jul 23, 2020 16:29

I don't use a lot Notepad++ but it's very fast for when loading big files and usefull for some tasks like files display in 2 windows and differences between two files.

Now Freeasic is integrated to Notepad but the function list is not implemented. So I added (in functionlist.xml) the parser written by dstein adding some elements for removing the declare lines and displaying operators, constructors and destructors.

Code: Select all

         <parser id="fb_function" displayName="FreeBASIC" commentExpr="(^[ \t]*'.*?$|/'.*?./)">
            <function
               mainExpr="(?<!declare\b\s)(\bsub\b|\bfunction\b|\boperator\b|\bConstructor\b|\bdestructor\b)[ \t]+[a-z0-9_]*"
               displayMode="$functionName">
               <functionName>
                  <nameExpr expr="(sub|function|operator|constructor|destructor)[ \t]+[a-z0-9_]+"/>
               </functionName>
            </function>
         </parser>

And I downloaded all the source code for finding freebasic's langid : 69 and to be able to add also this line :

Code: Select all

         <association id=        "fb_function"     langID="69"                          />


Now I don't know how to solve the following case :

In a such line " xxx yyy sub zzz" how avoid to retrieve zzz. I tried to play with the quote without success. Any help from a regular expression guru is welcome.

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 3 guests