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

Xeora Language implementation #1239

Merged
merged 10 commits into from
Dec 6, 2017
Merged

Xeora Language implementation #1239

merged 10 commits into from
Dec 6, 2017

Conversation

freakmaxi
Copy link
Contributor

@freakmaxi freakmaxi commented Dec 2, 2017

Hello,

This is the Xeora Web Development Framework grammar implementation.

http://www.xeora.org
https://www.github.com/xeora

Thanks...

Copy link
Contributor

@Golmote Golmote left a 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.

}
},
'variable': {
pattern: /\$(@?)(#+|[\-+*~=^])?[\w\.]+\$/,
Copy link
Contributor

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 ?:.

pattern: /\$(@?)(#+|[\-+*~=^])?[\w\.]+\$/,
inside: {
'punctuation': {
pattern: /\$|\./
Copy link
Contributor

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 [$.]

pattern: /\$|\./
},
'operator': {
pattern: /@|#+|\^|-|\+|\*|~|=/
Copy link
Contributor

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 #+|[-+*~=^@]

alias: 'function'
},
'function-block': {
pattern: /\$XF:{[\.\w\-]+\?[\.\w\-]+(,((\|)?([#\.^\-+*~]*([\w+][^$]*)|=([\S+][^$]*)|@[#\-]*(\w+\.)[\w+\.]+)?)*)?}:XF\$/,
Copy link
Contributor

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?

pattern: /\$XF:{[\.\w\-]+\?[\.\w\-]+(,((\|)?([#\.^\-+*~]*([\w+][^$]*)|=([\S+][^$]*)|@[#\-]*(\w+\.)[\w+\.]+)?)*)?}:XF\$/,
inside: {
'punctuation': {
pattern: /\$|:|{|}|\?|\.|,|\|/
Copy link
Contributor

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 [$:{}?.,|]

alias: 'function'
},
'directive-block-open': {
pattern: /\$\w+:{|\$\w(#\d+(\+)?)?(\[[\.\w\-]+])?:[\.\w\-]+:{(![A-Z]+)?/,
Copy link
Contributor

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.

alias: 'function'
},
'directive-block-separator': {
pattern: /}:[\.\w\-]+:{/,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[\.\w\-] -> [.\w-]

pattern: /}:[\.\w\-]+:{/,
inside: {
'punctuation': {
pattern: /}|:|{/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified to [:{}]

alias: 'function'
},
'directive-block-close': {
pattern: /}:[\.\w\-]+\$/,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as previously.

pattern: /}:[\.\w\-]+\$/,
inside: {
'punctuation': {
pattern: /}|:|\$/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified to [}:$]

@Golmote
Copy link
Contributor

Golmote commented Dec 6, 2017

@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.)

@freakmaxi
Copy link
Contributor Author

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"
Copy link
Contributor

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!

@Golmote Golmote merged commit 0fffa9d into PrismJS:gh-pages Dec 6, 2017
@Golmote
Copy link
Contributor

Golmote commented Dec 6, 2017

Thanks for contributing!

@freakmaxi
Copy link
Contributor Author

I thank you for your interest and cooperation. That was a pleasure for me 👍

papandreou added a commit to papandreou/prism that referenced this pull request Jan 29, 2018
* 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
  ...
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

Successfully merging this pull request may close these issues.

None yet

2 participants