Skip to content

Commit 48fac3b

Browse files
Added a test for identifier support across all languages (#2371)
1 parent de8ed16 commit 48fac3b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+397
-154
lines changed

components/prism-apl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Prism.languages.apl = {
44
pattern: /'(?:[^'\r\n]|'')*'/,
55
greedy: true
66
},
7-
'number': /¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|)(?:j¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|))?/i,
7+
'number': /¯?(?:\d*\.?\b\d+(?:e[+¯]?\d+)?|¯|)(?:j¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|))?/i,
88
'statement': /:[A-Z][a-z][A-Za-z]*\b/,
99
'system-function': {
1010
pattern: /[A-Z]+/i,

components/prism-apl.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-asm6502.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ Prism.languages.asm6502 = {
66
},
77
'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
88
'opcode': {
9-
pattern: /\b(?:adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya|ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA)\b/,
9+
pattern: /\b(?:adc|and|asl|bcc|bcs|beq|bit|bmi|bne|bpl|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|pla|plp|rol|ror|rti|rts|sbc|sec|sed|sei|sta|stx|sty|tax|tay|tsx|txa|txs|tya|ADC|AND|ASL|BCC|BCS|BEQ|BIT|BMI|BNE|BPL|BRK|BVC|BVS|CLC|CLD|CLI|CLV|CMP|CPX|CPY|DEC|DEX|DEY|EOR|INC|INX|INY|JMP|JSR|LDA|LDX|LDY|LSR|NOP|ORA|PHA|PHP|PLA|PLP|ROL|ROR|RTI|RTS|SBC|SEC|SED|SEI|STA|STX|STY|TAX|TAY|TSX|TXA|TXS|TYA)\b/,
1010
alias: 'property'
1111
},
1212
'hexnumber': {
13-
pattern: /#?\$[\da-f]{2,4}/i,
13+
pattern: /#?\$[\da-f]{2,4}\b/i,
1414
alias: 'string'
1515
},
1616
'binarynumber': {
17-
pattern: /#?%[01]+/,
17+
pattern: /#?%[01]+\b/,
1818
alias: 'string'
1919
},
2020
'decimalnumber': {
21-
pattern: /#?\d+/,
21+
pattern: /#?\b\d+\b/,
2222
alias: 'string'
2323
},
2424
'register': {

components/prism-asm6502.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-css-extras.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
});
7676

7777
var unit = {
78-
pattern: /(\d)(?:%|[a-z]+)/,
78+
pattern: /(\b\d+)(?:%|[a-z]+\b)/,
7979
lookbehind: true
8080
};
8181
// 123 -123 .123 -.123 12.3 -12.3
@@ -107,6 +107,7 @@
107107
}
108108
}
109109
],
110+
// it's important that there is no boundary assertion after the hex digits
110111
'entity': /\\[\da-f]{1,8}/i,
111112
'unit': unit,
112113
'number': number

components/prism-css-extras.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-ebnf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Prism.languages.ebnf = {
1515
lookbehind: true,
1616
alias: ['rule', 'keyword']
1717
},
18-
'rule': /[a-z]\w*(?:[ \t]+[a-z]\w*)*/i,
18+
'rule': /\b[a-z]\w*(?:[ \t]+[a-z]\w*)*\b/i,
1919

2020
'punctuation': /\([:/]|[:/]\)|[.,;()[\]{}]/,
2121
'operator': /[-=|*/!]/

components/prism-ebnf.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-eiffel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Prism.languages.eiffel = {
3030
// hexa | octal | bin
3131
/\b0[xcb][\da-f](?:_*[\da-f])*\b/i,
3232
// Decimal
33-
/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?e[+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/i
33+
/(?:\b\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?e[+-]?)?\d(?:_*\d)*\b|\b\d(?:_*\d)*\b\.?/i
3434
],
3535
'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/,
3636
'operator': /\\\\|\|\.\.\||\.\.|\/[~\/=]?|[><]=?|[-+*^=~]/

components/prism-eiffel.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-excel-formula.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ Prism.languages['excel-formula'] = {
3838
}
3939
},
4040
'function-name': {
41-
pattern: /[A-Z]\w*(?=\()/i,
41+
pattern: /\b[A-Z]\w*(?=\()/i,
4242
alias: 'keyword'
4343
},
4444
'range': {
45-
pattern: /\$?(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)/i,
45+
pattern: /\$?\b(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)\b/i,
4646
alias: 'property',
4747
inside: {
4848
'operator': /:/,
@@ -54,7 +54,7 @@ Prism.languages['excel-formula'] = {
5454
'cell': {
5555
// Excel is case insensitive, so the string "foo1" could be either a variable or a cell.
5656
// To combat this, we match cells case insensitive, if the contain at least one "$", and case sensitive otherwise.
57-
pattern: /[A-Z]+\d+|\$[A-Za-z]+\$?\d+|[A-Za-z]+\$\d+/,
57+
pattern: /\b[A-Z]+\d+\b|\$[A-Za-z]+\$?\d+\b|\b[A-Za-z]+\$\d+\b/,
5858
alias: 'property'
5959
},
6060
'number': /(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e[+-]?\d+)?\b/i,

components/prism-excel-formula.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/prism-hcl.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ Prism.languages.hcl = {
2626
}
2727
}
2828
},
29-
{
30-
pattern: /[\w-]+(?=\s+{)/
31-
}
29+
/[\w-]+(?=\s+{)/
3230
],
3331
'property': [
3432
/[\w-\.]+(?=\s*=(?!=))/,
@@ -53,13 +51,13 @@ Prism.languages.hcl = {
5351
pattern: /"(?:\\[\s\S]|[^\\"])*"/,
5452
greedy: true,
5553
},
56-
'number': /\b0x[\da-f]+|\d+\.?\d*(?:e[+-]?\d+)?/i,
54+
'number': /\b0x[\da-f]+\b|\b\d+\.?\d*(?:e[+-]?\d+)?/i,
5755
'punctuation': /[!\$#%&'()*+,.\/;<=>@\[\\\]^`{|}~?:]/,
5856
}
5957
},
6058
}
6159
},
62-
'number': /\b0x[\da-f]+|\d+\.?\d*(?:e[+-]?\d+)?/i,
60+
'number': /\b0x[\da-f]+\b|\b\d+\.?\d*(?:e[+-]?\d+)?/i,
6361
'boolean': /\b(?:true|false)\b/i,
6462
'punctuation': /[=\[\]{}]/,
6563
};

0 commit comments

Comments
 (0)