Syntax Highlighting tool, Markdown guide, unread share badge, Open in menu
- Syntax Highlighting (/syntax): highlight.js tokens rendered with VS Code (Dark/Light Modern, One Dark Pro, Monokai, Dracula, GitHub) and Android Studio (Darcula, Dark, IntelliJ Light) colors; copy as rich text (VS Code clipboard HTML), download RTF, share. Format via Prettier/sql-formatter (lazy-loaded), the JSON printer, or built-in whitespace-only formatters for brace languages, Python and XML. - Markdown: Guide dialog, source next to rendered output, with Insert. - Pastes created by Share count as unread on the Pastebin nav badge. - Paste view: Open in menu built from registry opensPaste tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f4232ef9b5
commit
dc2b12a3c6
37 changed files with 3704 additions and 27 deletions
18
app/static/vendor/nearley.mjs
vendored
Normal file
18
app/static/vendor/nearley.mjs
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* Bundled by jsDelivr using Rollup v4.62.2 and esbuild v0.28.1.
|
||||
* Original file: /npm/nearley@2.20.1/lib/nearley.js
|
||||
*
|
||||
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||
*/
|
||||
var g={exports:{}},N=g.exports,k;function O(){return k||(k=1,(function(b){(function(c,u){b.exports?b.exports=u():c.nearley=u()})(N,function(){function c(t,e,r){return this.id=++c.highestId,this.name=t,this.symbols=e,this.postprocess=r,this}c.highestId=0,c.prototype.toString=function(t){var e=typeof t>"u"?this.symbols.map(S).join(" "):this.symbols.slice(0,t).map(S).join(" ")+" \u25CF "+this.symbols.slice(t).map(S).join(" ");return this.name+" \u2192 "+e};function u(t,e,r,i){this.rule=t,this.dot=e,this.reference=r,this.data=[],this.wantedBy=i,this.isComplete=this.dot===t.symbols.length}u.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},u.prototype.nextState=function(t){var e=new u(this.rule,this.dot+1,this.reference,this.wantedBy);return e.left=this,e.right=t,e.isComplete&&(e.data=e.build(),e.right=void 0),e},u.prototype.build=function(){var t=[],e=this;do t.push(e.right.data),e=e.left;while(e.left);return t.reverse(),t},u.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,l.fail))};function v(t,e){this.grammar=t,this.index=e,this.states=[],this.wants={},this.scannable=[],this.completed={}}v.prototype.process=function(t){for(var e=this.states,r=this.wants,i=this.completed,s=0;s<e.length;s++){var n=e[s];if(n.isComplete){if(n.finish(),n.data!==l.fail){for(var h=n.wantedBy,o=h.length;o--;){var p=h[o];this.complete(p,n)}if(n.reference===this.index){var a=n.rule.name;(this.completed[a]=this.completed[a]||[]).push(n)}}}else{var a=n.rule.symbols[n.dot];if(typeof a!="string"){this.scannable.push(n);continue}if(r[a]){if(r[a].push(n),i.hasOwnProperty(a))for(var f=i[a],o=0;o<f.length;o++){var x=f[o];this.complete(n,x)}}else r[a]=[n],this.predict(a)}}},v.prototype.predict=function(t){for(var e=this.grammar.byName[t]||[],r=0;r<e.length;r++){var i=e[r],s=this.wants[t],n=new u(i,0,this.index,s);this.states.push(n)}},v.prototype.complete=function(t,e){var r=t.nextState(e);this.states.push(r)};function y(t,e){this.rules=t,this.start=e||this.rules[0].name;var r=this.byName={};this.rules.forEach(function(i){r.hasOwnProperty(i.name)||(r[i.name]=[]),r[i.name].push(i)})}y.fromCompiled=function(i,e){var r=i.Lexer;i.ParserStart&&(e=i.ParserStart,i=i.ParserRules);var i=i.map(function(n){return new c(n.name,n.symbols,n.postprocess)}),s=new y(i,e);return s.lexer=r,s};function d(){this.reset("")}d.prototype.reset=function(t,e){this.buffer=t,this.index=0,this.line=e?e.line:1,this.lastLineBreak=e?-e.col:0},d.prototype.next=function(){if(this.index<this.buffer.length){var t=this.buffer[this.index++];return t===`
|
||||
`&&(this.line+=1,this.lastLineBreak=this.index),{value:t}}},d.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},d.prototype.formatError=function(t,e){var r=this.buffer;if(typeof r=="string"){var i=r.split(`
|
||||
`).slice(Math.max(0,this.line-5),this.line),s=r.indexOf(`
|
||||
`,this.index);s===-1&&(s=r.length);var n=this.index-this.lastLineBreak,h=String(this.line).length;return e+=" at line "+this.line+" col "+n+`:
|
||||
|
||||
`,e+=i.map(function(p,a){return o(this.line-i.length+a+1,h)+" "+p},this).join(`
|
||||
`),e+=`
|
||||
`+o("",h+n)+`^
|
||||
`,e}else return e+" at index "+(this.index-1);function o(p,a){var f=String(p);return Array(a-f.length+1).join(" ")+f}};function l(t,e,r){if(t instanceof y)var i=t,r=e;else var i=y.fromCompiled(t,e);this.grammar=i,this.options={keepHistory:!1,lexer:i.lexer||new d};for(var s in r||{})this.options[s]=r[s];this.lexer=this.options.lexer,this.lexerState=void 0;var n=new v(i,0);this.table=[n],n.wants[i.start]=[],n.predict(i.start),n.process(),this.current=0}l.fail={},l.prototype.feed=function(t){var e=this.lexer;e.reset(t,this.lexerState);for(var r;;){try{if(r=e.next(),!r)break}catch(w){var h=new v(this.grammar,this.current+1);this.table.push(h);var i=new Error(this.reportLexerError(w));throw i.offset=this.current,i.token=w.token,i}var s=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var n=this.current+1,h=new v(this.grammar,n);this.table.push(h);for(var o=r.text!==void 0?r.text:r.value,p=e.constructor===d?r.value:r,a=s.scannable,f=a.length;f--;){var x=a[f],m=x.rule.symbols[x.dot];if(m.test?m.test(p):m.type?m.type===r.type:m.literal===o){var C=x.nextState({data:p,token:r,isToken:!0,reference:n-1});h.states.push(C)}}if(h.process(),h.states.length===0){var i=new Error(this.reportError(r));throw i.offset=this.current,i.token=r,i}this.options.keepHistory&&(s.lexerState=e.save()),this.current++}return s&&(this.lexerState=e.save()),this.results=this.finish(),this},l.prototype.reportLexerError=function(t){var e,r,i=t.token;return i?(e="input "+JSON.stringify(i.text[0])+" (lexer error)",r=this.lexer.formatError(i,"Syntax error")):(e="input (lexer error)",r=t.message),this.reportErrorCommon(r,e)},l.prototype.reportError=function(t){var e=(t.type?t.type+" token: ":"")+JSON.stringify(t.value!==void 0?t.value:t),r=this.lexer.formatError(t,"Syntax error");return this.reportErrorCommon(r,e)},l.prototype.reportErrorCommon=function(t,e){var r=[];r.push(t);var i=this.table.length-2,s=this.table[i],n=s.states.filter(function(o){var p=o.rule.symbols[o.dot];return p&&typeof p!="string"});if(n.length===0)r.push("Unexpected "+e+`. I did not expect any more input. Here is the state of my parse table:
|
||||
`),this.displayStateStack(s.states,r);else{r.push("Unexpected "+e+`. Instead, I was expecting to see one of the following:
|
||||
`);var h=n.map(function(o){return this.buildFirstStateStack(o,[])||[o]},this);h.forEach(function(o){var p=o[0],a=p.rule.symbols[p.dot],f=this.getSymbolDisplay(a);r.push("A "+f+" based on:"),this.displayStateStack(o,r)},this)}return r.push(""),r.join(`
|
||||
`)},l.prototype.displayStateStack=function(t,e){for(var r,i=0,s=0;s<t.length;s++){var n=t[s],h=n.rule.toString(n.dot);h===r?i++:(i>0&&e.push(" ^ "+i+" more lines identical to this"),i=0,e.push(" "+h)),r=h}},l.prototype.getSymbolDisplay=function(t){return E(t)},l.prototype.buildFirstStateStack=function(t,e){if(e.indexOf(t)!==-1)return null;if(t.wantedBy.length===0)return[t];var r=t.wantedBy[0],i=[t].concat(e),s=this.buildFirstStateStack(r,i);return s===null?null:[t].concat(s)},l.prototype.save=function(){var t=this.table[this.current];return t.lexerState=this.lexerState,t},l.prototype.restore=function(t){var e=t.index;this.current=e,this.table[e]=t,this.table.splice(e+1),this.lexerState=t.lexerState,this.results=this.finish()},l.prototype.rewind=function(t){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[t])},l.prototype.finish=function(){var t=[],e=this.grammar.start,r=this.table[this.table.length-1];return r.states.forEach(function(i){i.rule.name===e&&i.dot===i.rule.symbols.length&&i.reference===0&&i.data!==l.fail&&t.push(i)}),t.map(function(i){return i.data})};function E(t){var e=typeof t;if(e==="string")return t;if(e==="object"){if(t.literal)return JSON.stringify(t.literal);if(t instanceof RegExp)return"character matching "+t;if(t.type)return t.type+" token";if(t.test)return"token matching "+String(t.test);throw new Error("Unknown symbol type: "+t)}}function S(t){var e=typeof t;if(e==="string")return t;if(e==="object"){if(t.literal)return JSON.stringify(t.literal);if(t instanceof RegExp)return t.toString();if(t.type)return"%"+t.type;if(t.test)return"<"+String(t.test)+">";throw new Error("Unknown symbol type: "+t)}}return{Parser:l,Grammar:y,Rule:c}})})(g)),g.exports}var B=O();export{B as default};
|
||||
Loading…
Add table
Add a link
Reference in a new issue