Add tremor project DSL langauge definitions#3087
Merged
RunDevelopment merged 8 commits intoPrismJS:masterfrom Sep 21, 2021
Merged
Add tremor project DSL langauge definitions#3087RunDevelopment merged 8 commits intoPrismJS:masterfrom
RunDevelopment merged 8 commits intoPrismJS:masterfrom
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%). Details
|
RunDevelopment
requested changes
Sep 20, 2021
Member
RunDevelopment
left a comment
There was a problem hiding this comment.
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>
Contributor
Author
|
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
Member
|
With my PR merged, I don't have anything to add. |
RunDevelopment
approved these changes
Sep 21, 2021
Member
|
Thank you for contributing @darach! |
Contributor
Author
|
No - thank you for the contributor experience. You just won a few more fans in myself and the whole tremor community! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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