Skip to content

Commit

Permalink
Added a test for identifier support across all languages (#2371)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Jun 12, 2020
1 parent de8ed16 commit 48fac3b
Show file tree
Hide file tree
Showing 55 changed files with 397 additions and 154 deletions.
2 changes: 1 addition & 1 deletion components/prism-apl.js
Expand Up @@ -4,7 +4,7 @@ Prism.languages.apl = {
pattern: /'(?:[^'\r\n]|'')*'/,
greedy: true
},
'number': /¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞))?/i,
'number': /¯?(?:\d*\.?\b\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:\d*\.?\d+(?:e[+¯]?\d+)?|¯|∞))?/i,
'statement': /:[A-Z][a-z][A-Za-z]*\b/,
'system-function': {
pattern: /⎕[A-Z]+/i,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-apl.min.js

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

8 changes: 4 additions & 4 deletions components/prism-asm6502.js
Expand Up @@ -6,19 +6,19 @@ Prism.languages.asm6502 = {
},
'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
'opcode': {
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/,
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/,
alias: 'property'
},
'hexnumber': {
pattern: /#?\$[\da-f]{2,4}/i,
pattern: /#?\$[\da-f]{2,4}\b/i,
alias: 'string'
},
'binarynumber': {
pattern: /#?%[01]+/,
pattern: /#?%[01]+\b/,
alias: 'string'
},
'decimalnumber': {
pattern: /#?\d+/,
pattern: /#?\b\d+\b/,
alias: 'string'
},
'register': {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-asm6502.min.js

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

3 changes: 2 additions & 1 deletion components/prism-css-extras.js
Expand Up @@ -75,7 +75,7 @@
});

var unit = {
pattern: /(\d)(?:%|[a-z]+)/,
pattern: /(\b\d+)(?:%|[a-z]+\b)/,
lookbehind: true
};
// 123 -123 .123 -.123 12.3 -12.3
Expand Down Expand Up @@ -107,6 +107,7 @@
}
}
],
// it's important that there is no boundary assertion after the hex digits
'entity': /\\[\da-f]{1,8}/i,
'unit': unit,
'number': number
Expand Down
2 changes: 1 addition & 1 deletion components/prism-css-extras.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-ebnf.js
Expand Up @@ -15,7 +15,7 @@ Prism.languages.ebnf = {
lookbehind: true,
alias: ['rule', 'keyword']
},
'rule': /[a-z]\w*(?:[ \t]+[a-z]\w*)*/i,
'rule': /\b[a-z]\w*(?:[ \t]+[a-z]\w*)*\b/i,

'punctuation': /\([:/]|[:/]\)|[.,;()[\]{}]/,
'operator': /[-=|*/!]/
Expand Down
2 changes: 1 addition & 1 deletion components/prism-ebnf.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-eiffel.js
Expand Up @@ -30,7 +30,7 @@ Prism.languages.eiffel = {
// hexa | octal | bin
/\b0[xcb][\da-f](?:_*[\da-f])*\b/i,
// Decimal
/(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?e[+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/i
/(?:\b\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?e[+-]?)?\d(?:_*\d)*\b|\b\d(?:_*\d)*\b\.?/i
],
'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/,
'operator': /\\\\|\|\.\.\||\.\.|\/[~\/=]?|[><]=?|[-+*^=~]/
Expand Down
2 changes: 1 addition & 1 deletion components/prism-eiffel.min.js

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

6 changes: 3 additions & 3 deletions components/prism-excel-formula.js
Expand Up @@ -38,11 +38,11 @@ Prism.languages['excel-formula'] = {
}
},
'function-name': {
pattern: /[A-Z]\w*(?=\()/i,
pattern: /\b[A-Z]\w*(?=\()/i,
alias: 'keyword'
},
'range': {
pattern: /\$?(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)/i,
pattern: /\$?\b(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)\b/i,
alias: 'property',
inside: {
'operator': /:/,
Expand All @@ -54,7 +54,7 @@ Prism.languages['excel-formula'] = {
'cell': {
// Excel is case insensitive, so the string "foo1" could be either a variable or a cell.
// To combat this, we match cells case insensitive, if the contain at least one "$", and case sensitive otherwise.
pattern: /[A-Z]+\d+|\$[A-Za-z]+\$?\d+|[A-Za-z]+\$\d+/,
pattern: /\b[A-Z]+\d+\b|\$[A-Za-z]+\$?\d+\b|\b[A-Za-z]+\$\d+\b/,
alias: 'property'
},
'number': /(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e[+-]?\d+)?\b/i,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-excel-formula.min.js

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

8 changes: 3 additions & 5 deletions components/prism-hcl.js
Expand Up @@ -26,9 +26,7 @@ Prism.languages.hcl = {
}
}
},
{
pattern: /[\w-]+(?=\s+{)/
}
/[\w-]+(?=\s+{)/
],
'property': [
/[\w-\.]+(?=\s*=(?!=))/,
Expand All @@ -53,13 +51,13 @@ Prism.languages.hcl = {
pattern: /"(?:\\[\s\S]|[^\\"])*"/,
greedy: true,
},
'number': /\b0x[\da-f]+|\d+\.?\d*(?:e[+-]?\d+)?/i,
'number': /\b0x[\da-f]+\b|\b\d+\.?\d*(?:e[+-]?\d+)?/i,
'punctuation': /[!\$#%&'()*+,.\/;<=>@\[\\\]^`{|}~?:]/,
}
},
}
},
'number': /\b0x[\da-f]+|\d+\.?\d*(?:e[+-]?\d+)?/i,
'number': /\b0x[\da-f]+\b|\b\d+\.?\d*(?:e[+-]?\d+)?/i,
'boolean': /\b(?:true|false)\b/i,
'punctuation': /[=\[\]{}]/,
};

0 comments on commit 48fac3b

Please sign in to comment.