Conversation
0d3f303 to
4cd6fc1
Compare
|
There are four languages ( For example, in Lines 9 to 10 in ccbc10b Other languages have something similar (i.e., they extend more than one language via In prism/src/languages/typescript.ts Line 11 in ccbc10b prism/src/languages/typescript.ts Line 41 in ccbc10b prism/src/languages/typescript.ts Line 65 in ccbc10b @LeaVerou, HEEEEELP! 😅 |
38cf2f6 to
43492da
Compare
LeaVerou
left a comment
There was a problem hiding this comment.
This is too large to review, do you want to flag any parts that were not straightforward so I can focus on those?
Possibly. Let’s focus on getting the other ones merged, and I’ll take a look after. |
| import { toArray } from '../util/iterables'; | ||
| import javascript from './javascript'; | ||
| import type { GrammarToken, LanguageProto } from '../types'; | ||
| import type { Grammar, LanguageProto } from '../types'; |
There was a problem hiding this comment.
Let me point you to the languages I'd love you to review.
The first in this one—Flow. The reason: I used base and $merge here.
| // https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-appendix-reserved-words | ||
| 'class-name': [ | ||
| ...toArray(c['class-name']), | ||
| ...toArray(base!['class-name']), |
| grammar ({ extend, getLanguage }) { | ||
| const java = getLanguage('java'); | ||
| const { tag, entity } = getLanguage('markup'); | ||
| base: javadoclike, |
There was a problem hiding this comment.
This language: javadoc
| }, | ||
| }, | ||
| }, | ||
| $tokenize: embeddedIn('markup'), |
There was a problem hiding this comment.
This part (the latte language).
| pattern: | ||
| /\b(?:(?:[01]?\d\d?|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d\d?|2[0-4]\d|25[0-5])\b/, | ||
| greedy: true, | ||
| $merge: { |
There was a problem hiding this comment.
This language (mongodb): because of $merge.
| 'keyword': base!.keyword, | ||
| 'variable': base!.variable, | ||
| 'function': base!.function, | ||
| 'boolean': /\b(?:false|true)\b/, |
There was a problem hiding this comment.
The parser language: I used base inside the language definition.
| 'punctuation': /:/, | ||
| 'variable': variable, | ||
| 'operator': operator, | ||
| 'important': base!.important, |
There was a problem hiding this comment.
This part (the sass language)
src/languages/sqf.ts
Outdated
| pattern: /#[a-z]+\b/i, | ||
| alias: 'keyword', | ||
| }, | ||
| 'comment': base!.comment, |
There was a problem hiding this comment.
This part (the sqf language)
| /<\/?(?!\d)[a-z0-9]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i; | ||
|
|
||
| return textile; | ||
| $merge: { |
There was a problem hiding this comment.
The textile language (because of $merge)
| inside: { | ||
| 'punctuation': /^#\[\[|\]\]#$/, | ||
| return { | ||
| $merge: { |
There was a problem hiding this comment.
The velocity language (because of $merge)
| const tag = markup['tag'] as GrammarToken; | ||
| base: markup, | ||
| grammar ({ base }) { | ||
| const tag = base!['tag'] as GrammarToken; |
There was a problem hiding this comment.
This part (the wiki language)
| base: markup, | ||
| grammar () { | ||
| return { | ||
| $merge: { |
There was a problem hiding this comment.
The xquery language (because of $merge)
src/languages/wiki.ts
Outdated
| 'tag': { | ||
| // Prevent highlighting inside <nowiki>, <source> and <pre> tags | ||
| 'nowiki': { | ||
| pattern: /<(nowiki|pre|source)\b[^>]*>[\s\S]*?<\/\1>/i, |
There was a problem hiding this comment.
When you're only inserting one token before another, $before: 'tag' in the nowiki token could help reduce the levels of indentation
There was a problem hiding this comment.
Yes, this is much simpler. Thank you!
LeaVerou
left a comment
There was a problem hiding this comment.
I didn't review in a ton of depth, but at a glance everything LGTM!
43492da to
3c8263d
Compare
I’m gonna add transformed languages here on the go.