Skip to content
Prev Previous commit
Next Next commit
fix: simple mistakes in patterns
fix: use single quotes for token names
  • Loading branch information
TomPavelec committed Oct 12, 2020
commit 39b2eaf8dc5cce04add153258a3f83ee0da8ea7f
30 changes: 15 additions & 15 deletions components/prism-php.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
lookbehind: true
},
'class-name': {
pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s+\()\b[a-zA-Z_][\w]*(?!\\)\b/i,
pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s+\()\b[a-zA-Z_]\w*(?!\\)\b/i,
lookbehind: true,
},
'number': /\b0b[01]+\b|\b0x[\da-f]+\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)*|\B\.\d+)(?:e[+-]?\d+)?/i,
Expand All @@ -53,14 +53,14 @@
Prism.languages.insertBefore('php', 'class-name', {
'variable': /\$+(?:\w+\b|(?={))/i,
'package': {
pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\*\b[a-zA-Z_][\w]*)+\b(?!\\)/i,
pattern: /(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-zA-Z_]\w*)+\b(?!\\)/i,
lookbehind: true,
inside: {
punctuation: /\\/
'punctuation': /\\/
}
},
'type type-casting': {
pattern: /(\(\s*)\b(?:bool|boolean|int|integer|float|string|object|array(?!\s*\())\b(?=\s*\))/i,
pattern: /(\(\s*)\b(?:bool|boolean|int|integer|float|string|object|array)\b(?=\s*\))/i,
greedy: true,
lookbehind: true
},
Expand Down Expand Up @@ -155,47 +155,47 @@

Prism.languages.insertBefore('php', 'boolean', {
'class-name class-name-fully-qualified': {
pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s+\()(?:\\*\b[a-zA-Z_][\w]*)+\b(?!\\)/i,
pattern: /(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s+\()(?:\\?\b[a-zA-Z_]\w*)+\b(?!\\)/i,
greedy: true,
inside: {
punctuation: /\\/
'punctuation': /\\/
},
lookbehind: true
},
'class-name static-context': {
pattern: /\b[a-zA-Z_][\w]*(?!\\)\b(?=\s*::)/i,
pattern: /\b[a-zA-Z_]\w*(?=\s*::)/i,
greedy: true,
},
'class-name class-name-fully-qualified static-context': {
pattern: /(?:\\*\b[a-zA-Z_][\w]*)+\b(?!\\)(?=\s*::)/i,
pattern: /(?:\\?\b[a-zA-Z_]\w*)+(?=\s*::)/i,
greedy: true,
inside: {
punctuation: /\\/
'punctuation': /\\/
}
},
'class-name type-hint': {
pattern: /([(,?]\s*)\b[a-zA-Z_][\w]*(?!\\)\b(?=\s*\$)/i,
pattern: /([(,?]\s*)[a-zA-Z_]\w*(?=\s*\$)/i,
greedy: true,
lookbehind: true
},
'class-name class-name-fully-qualified type-hint': {
pattern: /([(,?]\s*)(?:\\*\b[a-zA-Z_][\w]*)+\b(?!\\)(?=\s*\$)/i,
pattern: /([(,?]\s*)(?:\\?\b[a-zA-Z_]\w*)+(?=\s*\$)/i,
greedy: true,
inside: {
punctuation: /\\/
'punctuation': /\\/
},
lookbehind: true
},
'class-name return-type': {
pattern: /(\)\s*:\s*\?*\s*)\b[a-zA-Z_][\w]*(?!\\)\b/i,
pattern: /(\)\s*:\s*\?*\s*)\b[a-zA-Z_]\w*(?!\\)\b/i,
greedy: true,
lookbehind: true
},
'class-name class-name-fully-qualified return-type': {
pattern: /(\)\s*:\s*\?*\s*)(?:\\*\b[a-zA-Z_][\w]*)+\b(?!\\)/i,
pattern: /(\)\s*:\s*\?*\s*)(?:\\?\b[a-zA-Z_]\w*)+\b(?!\\)/i,
greedy: true,
inside: {
punctuation: /\\/
'punctuation': /\\/
},
lookbehind: true
}
Expand Down
2 changes: 1 addition & 1 deletion components/prism-php.min.js

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