-
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
Xeora Language implementation #1239
Conversation
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.
Thanks for contributing. This is a great looking PR (and with tests! 🎉 ) Please take a look at my comments.
Also, could you include the minified version in the PR. It should have been generated by gulp
.
Finally, it would be great if you added an example file, on the same format as the existing ones.
components/prism-xeora.js
Outdated
} | ||
}, | ||
'variable': { | ||
pattern: /\$(@?)(#+|[\-+*~=^])?[\w\.]+\$/, |
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.
The parentheses around @?
are not needed.
You don't have to escape the dash -
in the character class since it's in this first position.
You don't need to escape the .
in the character class either: [\w.]
Since you don't use the capture, please make you parentheses non capturing, by adding ?:
.
components/prism-xeora.js
Outdated
pattern: /\$(@?)(#+|[\-+*~=^])?[\w\.]+\$/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /\$|\./ |
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.
This pattern can be simplified as [$.]
components/prism-xeora.js
Outdated
pattern: /\$|\./ | ||
}, | ||
'operator': { | ||
pattern: /@|#+|\^|-|\+|\*|~|=/ |
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.
This pattern can be simplified as #+|[-+*~=^@]
components/prism-xeora.js
Outdated
alias: 'function' | ||
}, | ||
'function-block': { | ||
pattern: /\$XF:{[\.\w\-]+\?[\.\w\-]+(,((\|)?([#\.^\-+*~]*([\w+][^$]*)|=([\S+][^$]*)|@[#\-]*(\w+\.)[\w+\.]+)?)*)?}:XF\$/, |
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.
You don't need to escape the dot and the dash in those character classes: [.\w-]
, [#-]*
, [\w+.]
The parentheses in (\|)?
can be removed: \|?
In the character class [#\.^\-+*~]
, if you move the dash around, you can remove all the escaping: [#.^+*~-]
You can remove the parentheses around ([\w+][^$]*)
, around ([\S+][^$]*)
and around (\w+\.)
Is this [\w+]
intended? This will match a single word-character or a single +
character, and I don't see many plus signs in the tests below... I have the same doubt for [\w+\.]+
, please double-check.
Please make the groups non-capturing.
Also, I'm a bit worried about the actual meaning of everything after the comma. If I simplify it, it goes like
(,(\|?(stuff)?)*)?
: the repeated group is allowed to match nothing at all. Is it intended?
components/prism-xeora.js
Outdated
pattern: /\$XF:{[\.\w\-]+\?[\.\w\-]+(,((\|)?([#\.^\-+*~]*([\w+][^$]*)|=([\S+][^$]*)|@[#\-]*(\w+\.)[\w+\.]+)?)*)?}:XF\$/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /\$|:|{|}|\?|\.|,|\|/ |
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.
This pattern can be simplified as [$:{}?.,|]
components/prism-xeora.js
Outdated
alias: 'function' | ||
}, | ||
'directive-block-open': { | ||
pattern: /\$\w+:{|\$\w(#\d+(\+)?)?(\[[\.\w\-]+])?:[\.\w\-]+:{(![A-Z]+)?/, |
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.
You can remove the parentheses around (\+)?
You can remove the escapes in [\.\w\-]
-> [.\w-]
Please make the groups non-capturing.
components/prism-xeora.js
Outdated
alias: 'function' | ||
}, | ||
'directive-block-separator': { | ||
pattern: /}:[\.\w\-]+:{/, |
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.
[\.\w\-]
-> [.\w-]
components/prism-xeora.js
Outdated
pattern: /}:[\.\w\-]+:{/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /}|:|{/ |
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.
Can be simplified to [:{}]
components/prism-xeora.js
Outdated
alias: 'function' | ||
}, | ||
'directive-block-close': { | ||
pattern: /}:[\.\w\-]+\$/, |
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.
Same comment as previously.
components/prism-xeora.js
Outdated
pattern: /}:[\.\w\-]+\$/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /}|:|\$/ |
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.
Can be simplified to [}:$]
@freakmaxi Can you please fix the example so that it's like all the others? (Add a title, explicitely state which class to use, add subtitles listing the main features of the component with examples in code blocks, etc.) |
Oh my god, I'm so sorry. I didn't realize that there is a format for examples. 😞 I'm fixing it immediately. |
components.js
Outdated
"xeora": { | ||
"title": "Xeora", | ||
"require": "markup", | ||
"owner": "xeora" |
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.
Please set the owner to you Github username "freakmaxi"
.
Once this is changed I think we're good to go!
Thanks for contributing! |
I thank you for your interest and cooperation. That was a pleasure for me 👍 |
* gh-pages: (326 commits) Add C++ platform-independent types (PrismJS#1271) Release 1.10.0 Unescaped markup plugin: Make it work with any language (PrismJS#1265) Previewers: New plugin combining previous plugins Previewer: Base, Previewer: Angle, Previewer: Color, Previewer: Easing, Previewer: Gradient and Previewer: Time. Fix PrismJS#913 (PrismJS#1244) Add Elm (elm-lang.org) support (PrismJS#1174) IchigoJam: Remove unneeded escape Run gulp add Io syntax (PrismJS#1251) package.json: add attribute `style` (PrismJS#1256) Add the C++11 raw string feature to the cpp language IchigoJam: Make strings greedy BASIC: Make strings greedy Run gulp Add support for IchigoJam BASIC (PrismJS#1246) Add support for 6502 assembly (PrismJS#1245) fix for autoloader plugin Run gulp and reorder components alphabetically Xeora Language implementation (PrismJS#1239) upgrade autoloader Release 1.9.0 ...
Hello,
This is the Xeora Web Development Framework grammar implementation.
http://www.xeora.org
https://www.github.com/xeora
Thanks...