Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FunctionList update: Add parser for Pascal/Delphi #3663

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@dinkumoil
Copy link

commented Aug 27, 2017

Closes #3664.

@MAPJe71
Copy link
Contributor

left a comment

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

@dinkumoil

This comment has been minimized.

Copy link
Author

commented Aug 30, 2017

@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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Author

commented Nov 23, 2017

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Author

commented Nov 26, 2017

@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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Author

commented Dec 31, 2017

@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
You can’t perform that action at this time.