Skip to content

Commit

Permalink
Merge branch 'master' into chaiscript
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Jan 24, 2021
2 parents 7e0b53a + 04ef309 commit e85942f
Show file tree
Hide file tree
Showing 35 changed files with 947 additions and 68 deletions.
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@
"alias": "dockerfile",
"owner": "JustinBeckwith"
},
"dot": {
"title": "DOT (Graphviz)",
"alias": "gv",
"optional": "markup",
"owner": "RunDevelopment"
},
"ebnf": {
"title": "EBNF",
"owner": "RunDevelopment"
Expand Down
77 changes: 77 additions & 0 deletions components/prism-dot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// https://www.graphviz.org/doc/info/lang.html

(function (Prism) {

var ID = '(?:' + [
// an identifier
/[a-zA-Z_\x80-\uFFFF][\w\x80-\uFFFF]*/.source,
// a number
/-?(?:\.\d+|\d+(?:\.\d*)?)/.source,
// a double-quoted string
/"[^"\\]*(?:\\[\s\S][^"\\]*)*"/.source,
// HTML-like string
/<(?:[^<>]|(?!<!--)<(?:[^<>"']|"[^"]*"|'[^']*')+>|<!--(?:[^-]|-(?!->))*-->)*>/.source
].join('|') + ')';

var IDInside = {
'markup': {
pattern: /(^<)[\s\S]+(?=>$)/,
lookbehind: true,
alias: ['language-markup', 'language-html', 'language-xml'],
inside: Prism.languages.markup
}
};

/**
* @param {string} source
* @param {string} flags
* @returns {RegExp}
*/
function withID(source, flags) {
return RegExp(source.replace(/<ID>/g, function () { return ID; }), flags);
}

Prism.languages.dot = {
'comment': {
pattern: /\/\/.*|\/\*[\s\S]*?\*\/|^#.*/m,
greedy: true
},
'graph-name': {
pattern: withID(/(\b(?:digraph|graph|subgraph)[ \t\r\n]+)<ID>/.source, 'i'),
lookbehind: true,
greedy: true,
alias: 'class-name',
inside: IDInside
},
'attr-value': {
pattern: withID(/(=[ \t\r\n]*)<ID>/.source),
lookbehind: true,
greedy: true,
inside: IDInside
},
'attr-name': {
pattern: withID(/([\[;, \t\r\n])<ID>(?=[ \t\r\n]*=)/.source),
lookbehind: true,
greedy: true,
inside: IDInside
},
'keyword': /\b(?:digraph|edge|graph|node|strict|subgraph)\b/i,
'compass-point': {
pattern: /(:[ \t\r\n]*)(?:[ns][ew]?|[ewc_])(?![\w\x80-\uFFFF])/,
lookbehind: true,
alias: 'builtin'
},
'node': {
pattern: withID(/(^|[^-.\w\x80-\uFFFF\\])<ID>/.source),
lookbehind: true,
greedy: true,
inside: IDInside
},
'operator': /[=:]|-[->]/,
'punctuation': /[\[\]{};,]/
};

Prism.languages.gv = Prism.languages.dot;

}(Prism));

1 change: 1 addition & 0 deletions components/prism-dot.min.js

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

14 changes: 13 additions & 1 deletion components/prism-elixir.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Prism.languages.elixir = {
alias: 'variable'
},
'number': /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i,
'keyword': /\b(?:after|alias|and|case|catch|cond|def(?:callback|exception|impl|module|p|protocol|struct)?|do|else|end|fn|for|if|import|not|or|require|rescue|try|unless|use|when)\b/,
'keyword': /\b(?:after|alias|and|case|catch|cond|def(?:callback|exception|impl|module|p|protocol|struct|delegate)?|do|else|end|fn|for|if|import|not|or|require|rescue|try|unless|use|when)\b/,
'boolean': /\b(?:true|false|nil)\b/,
'operator': [
/\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,
Expand All @@ -73,6 +73,18 @@ Prism.languages.elixir = {
'punctuation': /<<|>>|[.,%\[\]{}()]/
};

Prism.languages.insertBefore('elixir', 'keyword', {
'module': {
pattern: /\b(defmodule\s)[A-Z][\w.\\]+/,
lookbehind: true,
alias: 'class-name'
},
'function': {
pattern: /\b(defp?\s)[\w.\\]+/,
lookbehind: true
}
});

Prism.languages.elixir.string.forEach(function(o) {
o.inside = {
'interpolation': {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-elixir.min.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-fsharp.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Prism.languages.fsharp = Prism.languages.extend('clike', {
'comment': [
{
pattern: /(^|[^\\])\(\*[\s\S]*?\*\)/,
pattern: /(^|[^\\])\(\*(?!\))[\s\S]*?\*\)/,
lookbehind: true
},
{
Expand Down
2 changes: 1 addition & 1 deletion components/prism-fsharp.min.js

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

45 changes: 35 additions & 10 deletions components/prism-http.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
(function (Prism) {
Prism.languages.http = {
'request-line': {
pattern: /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\s(?:https?:\/\/|\/)\S+\sHTTP\/[0-9.]+/m,
pattern: /^(?:GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|PATCH|PRI|SEARCH)\s(?:https?:\/\/|\/)\S*\sHTTP\/[0-9.]+/m,
inside: {
// HTTP Verb
'property': /^(?:POST|GET|PUT|DELETE|OPTIONS|PATCH|TRACE|CONNECT)\b/,
// Path or query argument
'attr-name': /:\w+/
// HTTP Method
'method': {
pattern: /^[A-Z]+\b/,
alias: 'property'
},
// Request Target e.g. http://example.com, /path/to/file
'request-target': {
pattern: /^(\s)(?:https?:\/\/|\/)\S*(?=\s)/,
lookbehind: true,
alias: 'url'
},
// HTTP Version
'http-version': {
pattern: /^(\s)HTTP\/[0-9.]+/,
lookbehind: true,
alias: 'property'
},
}
},
'response-status': {
pattern: /^HTTP\/1.[01] \d.*/m,
pattern: /^HTTP\/[0-9.]+ \d+ .+/m,
inside: {
// Status, e.g. 200 OK
'property': {
pattern: /(^HTTP\/1.[01] )\d.*/i,
lookbehind: true
// HTTP Version
'http-version': {
pattern: /^HTTP\/[0-9.]+/,
alias: 'property'
},
// Status Code
'status-code': {
pattern: /^(\s)\d+(?=\s)/,
lookbehind: true,
alias: 'number'
},
// Reason Phrase
'reason-phrase': {
pattern: /^(\s).+/,
lookbehind: true,
alias: 'string'
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion components/prism-http.min.js

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

7 changes: 6 additions & 1 deletion components/prism-php.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
'punctuation': /\\/
}
},
'class-name-definition': {
pattern: /(\b(?:class|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,
lookbehind: true,
alias: 'class-name'
},
'keyword': [
{
pattern: /(\(\s*)\b(?:bool|boolean|int|integer|float|string|object|array)\b(?=\s*\))/i,
Expand Down Expand Up @@ -85,7 +90,7 @@
'argument-name': /\b[a-z_]\w*(?=\s*:(?!:))/i,
'class-name': [
{
pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,
greedy: true,
lookbehind: true
},
Expand Down
Loading

0 comments on commit e85942f

Please sign in to comment.