-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add tremor project DSL langauge definitions #3087
Add tremor project DSL langauge definitions #3087
Conversation
Signed-off-by: Darach Ennis <darach@gmail.com>
JS File Size Changes (gzipped)A total of 3 files have changed, with a combined diff of +837 B (+17.7%).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @darach!
I left you a few comments. Please make sure your tests and lints pass.
Regarding string interpolation: We can do it like this:
Prism.languages.tremor = {
...
'heredoc': ...,
'interpolated-string': null,
'function': ...
};
var string = {
pattern: /(^|[^\\])"(?:[^"\\\r\n%]|\\(?:\r\n|[\s\S])|%(?!\{)|%\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\})*"/,
lookbehind: true,
greedy: true,
inside: {
'interpolation': {
pattern: /%\{(?:[^"{}]|\{[^{}]*\}|"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))")*\}/,
inside: {
'punctuation': /^%\{|\}$/,
'expression': {
pattern: /[\s\S]+/,
inside: Prism.languages.tremor
}
}
},
'string': /[\s\S]+/
}
}
Prism.languages.tremor['interpolated-string'] = string;
Not perfect (doesn't really support nested interpolated strings) but a good start.
Apply fix worst-case time complexity per @RunDevelopment's insight Co-authored-by: Michael Schmidt <msrd0000@gmail.com>
Terser formulation of pattern Co-authored-by: Michael Schmidt <msrd0000@gmail.com>
Terser formulation of pattern Co-authored-by: Michael Schmidt <msrd0000@gmail.com>
Terser formulation of pattern Co-authored-by: Michael Schmidt <msrd0000@gmail.com>
Signed-off-by: Darach Ennis <darach@gmail.com>
I suspect i followed the contribution guide a little too closely, the following npm targets are ( super ) useful:
Lints and tests now all pass - apologies for missing these on the first round! |
Signed-off-by: Michael Schmidt <mitchi5000.ms@googlemail.com>
Improved Tremor tokenization
With my PR merged, I don't have anything to add. |
Thank you for contributing @darach! |
No - thank you for the contributor experience. You just won a few more fans in myself and the whole tremor community! |
Adds support for the tremor project domain specific languages
to prism so that we can leverage prism-based syntax highlighting in our new docusaurus
based documentation system.
Please let us know if we've missed anything in the contribution guidelines - these were
great and the tooling for tests is very helpful and assistive. Tip of the hat!
Tremor is an ASL2 licensed CNCF sandbox project - an event processing system with its own
embedded languages for defining user defined logic, queries etc...
Signed-off-by: Darach Ennis darach@gmail.com