Skip to content

FunctionList update: Add parser for Pascal/Delphi#3663

Closed
dinkumoil wants to merge 1 commit intonotepad-plus-plus:masterfrom
dinkumoil:master
Closed

FunctionList update: Add parser for Pascal/Delphi#3663
dinkumoil wants to merge 1 commit intonotepad-plus-plus:masterfrom
dinkumoil:master

Conversation

@dinkumoil
Copy link
Copy Markdown
Contributor

@dinkumoil dinkumoil commented Aug 27, 2017

Closes #3664.

@dinkumoil dinkumoil mentioned this pull request Aug 29, 2017
Copy link
Copy Markdown
Contributor

@MAPJe71 MAPJe71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide appropriate example source to be able to test/verify parser.

@dinkumoil
Copy link
Copy Markdown
Contributor Author

@MAPJe71 Thank you for your response.

Please provide appropriate example source to be able to test/verify parser.

I will do that after my holidays.

Do you also need a file with the expected results of the parser? I was not able to generate a parser result file with the following command line (Npp v7.5):

notepad++.exe -export=functionList -lpas "E:\ParserTest.pas"

The resulting file E:\ParserTest.result was empty.

@MAPJe71
Copy link
Copy Markdown
Contributor

MAPJe71 commented Aug 30, 2017

I will do that after my holidays.

👍 Enjoy your holdays!

Do you also need a file with the expected results of the parser?

👍 That would be great!

Try notepad++.exe -noPlugin -export=functionList "E:\ParserTest.pas" and make sure your "active" functionList.xml contains your Pascal/Delphi parser (yes obvious but had me puzzled).

@dinkumoil
Copy link
Copy Markdown
Contributor Author

After spending a lot of time trying to get the Delphi parser working (with no success) I close this PR.

I was not able to write regular expressions which are suitable for all features and coding variants of the Delphi language. Additionally there seem to be bugs in the underlying regex engine (Boost?).

IMHO it`s worth to think about the whole concept of a parser engine based on regular expressions. In the issue tracker one can find a lot of entries concerning malfunctions of various language parsers.

@dinkumoil dinkumoil closed this Nov 23, 2017
@MAPJe71
Copy link
Copy Markdown
Contributor

MAPJe71 commented Nov 25, 2017

@dinkumoil

I was not able to write regular expressions which are suitable for all features and coding variants of the Delphi language.

You could write a parser for each coding variant and activate just one with the right association.
It has already been done for Haskell (3 parsers: normal, literate and literate for LaTeX), COBOL (2 parsers: fixed and free form reference format) and Fortran (2 parsers: fixed and free form style; allthough also two language ID's).

it`s worth to think about the whole concept of a parser engine based on regular expressions.

IMO the regular expressions itself are not the root problem, it's more the Function List engine, how it uses RE's and expectations of users (compared to other editors and IDE's with a tag/function list implementation).

In the issue tracker one can find a lot of entries concerning malfunctions of various language parsers.

Yep, I'm trying to work on them as much as possible but it takes time.

@dinkumoil
Copy link
Copy Markdown
Contributor Author

@MAPJe71

You could write a parser for each coding variant and activate just one with the right association.

In Delphi there doesn't exist different coding standards (with different file extensions) like e.g. in Fortran. With coding variants I meant for instance

  • the presence or absence of certain sections in a Delphi source file (constants/types/variables declaration).
  • the order of these sections.
  • possible multiple occurence of sections.
  • mixing source code with comments.
  • generic classes/methods (the < and > characters were causing problems).
  • nested (generic) classes.
  • the indistinguishability of function/procedure prototypes and their headers at the point of implementation.
  • functions/procedures local to another function/procedure (with the ability of unlimited nesting).
  • functions/procedures local to another function/procedure mixed with constants/types/variables declaration sections and comments.

There are a lot more of detail problems (and their interconnections) I don't remember at the moment.

I am frustrated and fed up with this whole thing and I already deleted all my test cases and trials, so don't ask for them.

Maybe somebody who is better in regular expressions will implement a parser some day.

@plagoni
Copy link
Copy Markdown

plagoni commented Dec 30, 2017

Hi
I'm a long term user of Delphi Pascal and has used UltraEdit for years. I'm new to NotePad++ but it looks like a great alternative to UE with the only exception so far that the function list does not work (it is blank for a pas file in version 7.5.3 32bit).
I have searched the Net intensively and my best search result is this page.
I can see that I have no chance of fixing it myself (RegExp experience very limited) and has tried to figure out how to include the code from this site into my local FunctionList.xml.
Is there any guidelines how-to-do-it? Or will there be a new np++ version available soon with the pascal functionality included?

Thanks in advance and Happy New Year
Per

@dinkumoil
Copy link
Copy Markdown
Contributor Author

@plagoni

  1. Go to the Files changed section of this PR.
  2. Insert the green marked lines into the file C:\Users\<UserName>\AppData\Roaming\Notepad++\functionList.xml.

But note that the provided parser has some deficiencies and does not cover all possible coding variants and features of Delphi. I was not able to solve these problems and stopped development to avoid constantly emerging support and enhancement requests. So you are on your own if you use this parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Function List has no parser for Pascal/Delphi

4 participants