-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
added: ObjectPascal lexer #883
Conversation
Initial version (proposal) of an ObjectPascal lexer - the assembler state is not in use yet... - the Intrinsic Routines rule is commented out and probably not needed...
@alecthomas FYI: This is really just a quick proposal. On my machine it works very well and without errors, even on large (45k lines) files but I'm no expert when it comes to regex (performance, etc.) and I just don't have the time to work on that for much longer. Also I don't know how to reevaluate the assembler block with the assembler state or if and how this is even possible so if you should consider to accept the pull request you should probably just delete the assembler state and the commented lines in the file. The same goes for the Intrinsic Routines rule (that would be a bit too much anyway)... The results of the initial version are absolutely like I would expect them, there is even the brand new Delphi feature of multiline string literals implemented. Some people (including me) would be very happy to see this in the chroma lexer folder... |
Awesome, great start! Can you add one or more test files? See lexers/README.md for details. |
In particular, the test files shouldn't result in any errors. |
objectpascal testdata source: https://gitlab.com/freepascal.org/fpc/source
@alecthomas I took the testdata from the freepascal repository (https://gitlab.com/freepascal.org/fpc/source). I actually wanted to create a subfolder in testdata for the objectpascal test files and add the corresponding COPYING file to it, but when I ran the tests with the non-test file present, they unfortunately failed... Maybe this can be changed to fully meet the requirements for using such test data... |
refactored and cleaned
@alecthomas I've gone through everything again, tidied it up and think it's ready now. |
@alecthomas I've replaced the test data with my own nonsense code that covers most of the rules. |
@alecthomas I've tested everything again and I think that's it now. There is nothing more I can do. I hope the code provided is suitable enough to be merged. If more is needed, please let me know. |
Sorry, there was still a bug.... |
It would be nice if there was a special development style for debugging so that all token types could be clearly distinguished in the results output (e.g. html). |
That's not a bad idea. Currently I use LMK when you're ready to merge. |
I don't see any further issues at the moment, so just do it.... |
Initial version (proposal) of an ObjectPascal lexer