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

Using OysterKit for syntax highlight #88

Closed
eimantas opened this issue Sep 2, 2018 · 1 comment
Closed

Using OysterKit for syntax highlight #88

eimantas opened this issue Sep 2, 2018 · 1 comment
Assignees
Labels

Comments

@eimantas
Copy link
Contributor

eimantas commented Sep 2, 2018

I'm pretty new to this language creation thing using tools like STLR. I was wondering if OysterKit and STLR would be of any help in creating a simple editor with rudimentary syntax highlight (by recognizing language node types and providing location information in source string).

@SwiftStudies
Copy link
Owner

Yes, in fact I started creating it in order to do just that.

You can actually get away with a whole lot less than a full grammar to do syntax highlighting, and it can be a lot faster than actually "building" the IR.

OysterKit supports that with the TokenStreamIterable. You can see that in use in the example playground (OysterKit Tutorial.playground).

If you were go off and read the excellent Noodlesoft articles on syntax highlighting and use a TokenStream to get the tokens you can do pretty much anything you like and STLR is much better than regular expressions for achieving the highlighting (your example from yesterday wouldn't have been possible... regex just doesn't support nesting).

@SwiftStudies SwiftStudies self-assigned this Sep 2, 2018
@eimantas eimantas closed this as completed Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants