Syntax highligher for Notepad++ (FB0.91)

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
ecxjoe
Posts: 96
Joined: Aug 08, 2009 6:01
Location: Utah, USA
Contact:

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

Post by ecxjoe »

I started doing some FreeBASIC integration for Notepad++ as well.
I created an xml file for the function list. My version is here: https://github.com/jocabundus/npp-freeb ... nctionList.
Groups functions into their associate types, if they are part of a type.

Latest update copied here for posterity:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<!-- ==========================================================================\
|
|   To learn how to make your own language parser, please check the following
|   link:
|       https://npp-user-manual.org/docs/function-list/
|
\=========================================================================== -->
<NotepadPlus>
	<functionList>
		<!-- ============================================================================ [ FreeBASIC ] -->
		<!-- FreeBASIC - Free/Open Source (GPL), BASIC compiler for Microsoft Windows, DOS and Linux    -->

		<parser
			id         ="freebasic.xml"
			displayName="FreeBASIC - Free/Open Source (GPL), BASIC compiler for Microsoft Windows, DOS and Linux"
			commentExpr="(?s:\x2F\x27.*?\x27\x2F)|(?mi-s:(\x27|REM\s+).*?$)"
		>
			
			<function
				mainExpr="(^|:)[\t\x20]*((sub|function|constructor|destructor|property)[\t\x20]+[a-zA-Z0-9_\.]+|operator[\t\x20]+[a-zA-Z]*\.?([=+\-\*/\!@#$^&\\]+|\(\)|\[\]|<>))[\t\x20]*\(.*?\)([\t\x20]+\w+)*[\t\x20]*$"
			>
				<functionName>
					<nameExpr expr="((([\t\x20]+\.)?\w+)|([a-zA-Z]*\.?([=+\-\*/\!@#$^&\\]+|\(\)|\[\]|<>)))[\t\x20]*\(.*?\)([\t\x20]+\w+)*[\t\x20]*$" />
					<nameExpr expr="((([\t\x20]+\.)?\w+)|([a-zA-Z]*\.?([=+\-\*/\!@#$^&\\]+|\(\)|\[\]|<>)))" /> <!-- comment this line if you want to keep parameter list and return type -->
				</functionName>
				<className>
					<nameExpr expr="\w+\.[a-zA-Z_]+" />
					<nameExpr expr="^\w+" />
				</className>
			</function>
			
			<classRange
				mainExpr    ="(^|:)[\t\x20]*type[\t\x20]+\w+([\t\x20]+(extends|field)|[\t\x20]*\n)(.+?)\s+end[\t\x20]+type[\t\x20]*$"
			>
				<className>
					<nameExpr expr="(^|:)[\t\x20]*type[\t\x20]+\w+" />
					<nameExpr expr="\w+$" />
				</className>
				<function
					mainExpr="(^|:)[\t\x20]*declare[\t\x20]+((sub|function|constructor|destructor|property)[\t\x20]+[a-zA-Z0-9_\.]+|operator[\t\x20]+[a-zA-Z]*\.?([=+\-\*/\!@#$^&\\]+|\(\)|\[\]|<>))[\t\x20]*\(.*?\)([\t\x20]+\w+)*[\t\x20]*$"
				>
					<functionName>
						<funcNameExpr expr="((([\t\x20]+\.)?\w+)|([a-zA-Z]*\.?([=+\-\*/\!@#$^&\\]+|\(\)|\[\]|<>)))[\t\x20]*\(.*?\)([\t\x20]+\w+)*[\t\x20]*$" />
						<funcNameExpr expr="((([\t\x20]+\.)?\w+)|([a-zA-Z]*\.?([=+\-\*/\!@#$^&\\]+|\(\)|\[\]|<>)))" /> <!-- comment this line if you want to keep parameter list and return type -->
					</functionName>
				</function>
			</classRange>
			
		</parser>
	</functionList>
</NotepadPlus>
Post Reply