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

Implement syntax highlighting (both old/transitional syntax) #5

Open
theY4Kman opened this issue Jan 23, 2021 · 1 comment
Open

Implement syntax highlighting (both old/transitional syntax) #5

theY4Kman opened this issue Jan 23, 2021 · 1 comment

Comments

@theY4Kman
Copy link
Owner

Brief

As the core of any good IDE, the syntax-highlighting must be squeaky clean. The core of syntax-highlighting in IDEA relies on a JFlex lexer generated from a .flex definition, and a parser generated from a .bnf grammar.

Details

NOTE: until I feel my way around a bit, this ticket will be a bit short on details

Basically, the lexer should be pretty simple — not relying on backtracking or any other bad-worst-case feature of regular expressions. Good lexing should be quick and predictable. Preferably, some automated performance tests would verify speeds on some large source files.

The grammar should produce parse trees that very closely resemble what the SourcePawn compiler produces. This can be verified with the PsiViewer plugin. I would imagine Jetbrains provides some handy automated testing tools for verifying parse trees.

@theY4Kman
Copy link
Owner Author

theY4Kman commented Jan 30, 2021

Jeez, ya know, I just sort of assumed there was an official grammar out there :P I've been working on a first draft, aiming to parse the kitchen sink with the ugliest, messiest, rubber-bands-and-tape grammar that does the job; then starting fresh with a solid foundation (and much better naming).

This is what I've done so far (during late nights). Things like arbitrary blocks don't exist, yet. Complex logical expressions (&& ||) aren't a thing, yet, either. Nor if/else, switch, for, while, do/while (SP has those, right?), and on and on. And the naming is horrendous :P But it can sorta parse!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant