Skip to content

Commit

Permalink
Merge branch 'master' into web-idl
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Oct 11, 2021
2 parents b40e710 + 3b2238f commit 5fb8bc1
Show file tree
Hide file tree
Showing 337 changed files with 16,828 additions and 2,990 deletions.
3 changes: 2 additions & 1 deletion assets/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,9 @@

if ((!all[id].noCSS && !/\.js$/.test(filepath)) || /\.css$/.test(filepath)) {
var cssFile = filepath.replace(/(\.css)?$/, '.css');
var minCSSFile = cssFile.replace(/(?:\.css)$/, '.min.css');

info.files.minified.paths.push(cssFile);
info.files.minified.paths.push(minCSSFile);
info.files.dev.paths.push(cssFile);
}

Expand Down
64 changes: 12 additions & 52 deletions assets/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,62 +179,22 @@
language.examplesPromise.then(function (contents) {
examples[id].innerHTML = buildContentsHeader(id) + contents;

loadLanguage(id).then(function () {
Prism.highlightAllUnder(examples[id]);
/** @type {HTMLElement} */
var container = examples[id];
container.innerHTML = buildContentsHeader(id) + contents;

// the current language might be an extension of a language
// so to be safe, we explicitly add a dependency to the current language
$$('pre', container).forEach(/** @param {HTMLElement} pre */function (pre) {
var dependencies = (pre.getAttribute('data-dependencies') || '').trim();
dependencies = dependencies ? dependencies + ',' + id : id;
pre.setAttribute('data-dependencies', dependencies);
});

Prism.highlightAllUnder(container);
});
} else {
examples[id].innerHTML = '';
}
}

/**
* Loads a language, including all dependencies
*
* @param {string} lang the language to load
* @returns {Promise} the promise which resolves as soon as everything is loaded
*/
function loadLanguage(lang) {
// at first we need to fetch all dependencies for the main language
// Note: we need to do this, even if the main language already is loaded (just to be sure..)
//
// We load an array of all dependencies and call recursively this function on each entry
//
// dependencies is now an (possibly empty) array of loading-promises
var dependencies = getDependenciesOfLanguage(lang).map(loadLanguage);

// We create a promise, which will resolve, as soon as all dependencies are loaded.
// They need to be fully loaded because the main language may extend them.
return Promise.all(dependencies)
.then(function () {

// If the main language itself isn't already loaded, load it now
// and return the newly created promise (we chain the promises).
// If the language is already loaded, just do nothing - the next .then()
// will immediately be called
if (!Prism.languages[lang]) {
return new Promise(function (resolve) {
$u.script('components/prism-' + lang + '.js', resolve);
});
}
});
}


/**
* Returns all dependencies (as identifiers) of a specific language
*
* @param {string} lang
* @returns {string[]} the list of dependencies. Empty if the language has none.
*/
function getDependenciesOfLanguage(lang) {
if (!components.languages[lang] || !components.languages[lang].require) {
return [];
}

return ($u.type(components.languages[lang].require) === 'array')
? components.languages[lang].require
: [components.languages[lang].require];
}

}());
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"arduino": {
"title": "Arduino",
"require": "cpp",
"alias": "ino",
"owner": "dkern"
},
"arff": {
Expand All @@ -152,6 +153,10 @@
"title": "6502 Assembly",
"owner": "kzurawel"
},
"asmatmel": {
"title": "Atmel AVR Assembly",
"owner": "cerkit"
},
"autohotkey": {
"title": "AutoHotkey",
"owner": "aviaryan"
Expand Down
4 changes: 4 additions & 0 deletions components/prism-actionscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Prism.languages.actionscript = Prism.languages.extend('javascript', {
});
Prism.languages.actionscript['class-name'].alias = 'function';

// doesn't work with AS because AS is too complex
delete Prism.languages.actionscript['parameter'];
delete Prism.languages.actionscript['literal-property'];

if (Prism.languages.markup) {
Prism.languages.insertBefore('actionscript', 'string', {
'xml': {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-actionscript.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions components/prism-arduino.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/prism-arduino.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions components/prism-asmatmel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Prism.languages.asmatmel = {
'comment': {
pattern: /;.*/,
greedy: true
},
'string': {
pattern: /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
greedy: true
},

'constant': /\b(?:PORT[A-Z]|DDR[A-Z]|(?:DD|P)[A-Z](?:\d|[0-2]\d|3[0-1]))\b/,

'directive': {
pattern: /\.\w+(?= )/,
alias: 'property'
},
'r-register': {
pattern: /\br(?:\d|[1-2]\d|3[0-1])\b/,
alias: 'variable'
},
'op-code': {
pattern: /\b(?:ADC|ADD|ADIW|AND|ANDI|ASR|BCLR|BLD|BRBC|BRBS|BRCC|BRCS|BREAK|BREQ|BRGE|BRHC|BRHS|BRID|BRIE|BRLO|BRLT|BRMI|BRNE|BRPL|BRSH|BRTC|BRTS|BRVC|BRVS|BSET|BST|CALL|CBI|CBR|CLC|CLH|CLI|CLN|CLR|CLS|CLT|CLV|CLZ|COM|CP|CPC|CPI|CPSE|DEC|DES|EICALL|EIJMP|ELPM|EOR|FMUL|FMULS|FMULSU|ICALL|IJMP|IN|INC|JMP|LAC|LAS|LAT|LD|LD[A-Za-z0-9]|LPM|LSL|LSR|MOV|MOVW|MUL|MULS|MULSU|NEG|NOP|OR|ORI|OUT|POP|PUSH|RCALL|RET|RETI|RJMP|ROL|ROR|SBC|SBCI|SBI|SBIC|SBIS|SBIW|SBR|SBRC|SBRS|SEC|SEH|SEI|SEN|SER|SES|SET|SEV|SEZ|SLEEP|SPM|ST|ST[A-Z0-9]|SUB|SUBI|SWAP|TST|WDR|XCH|adc|add|adiw|and|andi|asr|bclr|bld|brbc|brbs|brcc|brcs|break|breq|brge|brhc|brhs|brid|brie|brlo|brlt|brmi|brne|brpl|brsh|brtc|brts|brvc|brvs|bset|bst|call|cbi|cbr|clc|clh|cli|cln|clr|cls|clt|clv|clz|com|cp|cpc|cpi|cpse|dec|des|eicall|eijmp|elpm|eor|fmul|fmuls|fmulsu|icall|ijmp|in|inc|jmp|lac|las|lat|ld|ld[a-z0-9]|lpm|lsl|lsr|mov|movw|mul|muls|mulsu|neg|nop|or|ori|out|pop|push|rcall|ret|reti|rjmp|rol|ror|sbc|sbci|sbi|sbic|sbis|sbiw|sbr|sbrc|sbrs|sec|seh|sei|sen|ser|ses|set|sev|sez|sleep|spm|st|st[a-zA-Z0-9]|sub|subi|swap|tst|wdr|xch)\b/,
alias: 'keyword'
},
'hex-number': {
pattern: /#?\$[\da-f]{2,4}\b/i,
alias: 'number'
},
'binary-number': {
pattern: /#?%[01]+\b/,
alias: 'number'
},
'decimal-number': {
pattern: /#?\b\d+\b/,
alias: 'number'
},
'register': {
pattern: /\b[acznvshtixy]\b/i,
alias: 'variable'
},
'operator': />>=?|<<=?|&&?|\|\|?|[-+*/%&|^!=<>?]=?/,
'punctuation': /[(),:]/
};
Loading

0 comments on commit 5fb8bc1

Please sign in to comment.