Setting ordinal for control code escapes
This commit is contained in:
parent
580af045d6
commit
d4b648fa43
@ -19,7 +19,7 @@ describe('parser/javascript/charset_escape.js', function() {
|
|||||||
'\\W': { label: 'non-word', ordinal: -1 },
|
'\\W': { label: 'non-word', ordinal: -1 },
|
||||||
'\\0': { label: 'null', ordinal: 0 },
|
'\\0': { label: 'null', ordinal: 0 },
|
||||||
'\\012': { label: 'octal: 12', ordinal: 10 },
|
'\\012': { label: 'octal: 12', ordinal: 10 },
|
||||||
'\\cx': { label: 'ctrl-x', ordinal: -1 },
|
'\\cx': { label: 'ctrl-X', ordinal: 24 },
|
||||||
'\\xab': { label: '0xAB', ordinal: 0xab },
|
'\\xab': { label: '0xAB', ordinal: 0xab },
|
||||||
'\\uabcd': { label: 'U+ABCD', ordinal: 0xabcd }
|
'\\uabcd': { label: 'U+ABCD', ordinal: 0xabcd }
|
||||||
}, (content, str) => {
|
}, (content, str) => {
|
||||||
|
@ -29,7 +29,7 @@ describe('parser/javascript/escape.js', function() {
|
|||||||
'\\8': { label: 'Back reference (group = 8)', ordinal: -1 },
|
'\\8': { label: 'Back reference (group = 8)', ordinal: -1 },
|
||||||
'\\9': { label: 'Back reference (group = 9)', ordinal: -1 },
|
'\\9': { label: 'Back reference (group = 9)', ordinal: -1 },
|
||||||
'\\012': { label: 'octal: 12', ordinal: 10 },
|
'\\012': { label: 'octal: 12', ordinal: 10 },
|
||||||
'\\cx': { label: 'ctrl-x', ordinal: -1 },
|
'\\cx': { label: 'ctrl-X', ordinal: 24 },
|
||||||
'\\xab': { label: '0xAB', ordinal: 0xab },
|
'\\xab': { label: '0xAB', ordinal: 0xab },
|
||||||
'\\uabcd': { label: 'U+ABCD', ordinal: 0xabcd }
|
'\\uabcd': { label: 'U+ABCD', ordinal: 0xabcd }
|
||||||
}, (content, str) => {
|
}, (content, str) => {
|
||||||
|
@ -50,7 +50,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
c() {
|
c() {
|
||||||
return [`ctrl-${this.arg}`, -1];
|
return [`ctrl-${this.arg.toUpperCase()}`, this.arg.toUpperCase().charCodeAt(0) - 64];
|
||||||
},
|
},
|
||||||
x() {
|
x() {
|
||||||
return [`0x${this.arg.toUpperCase()}`, parseInt(this.arg, 16)];
|
return [`0x${this.arg.toUpperCase()}`, parseInt(this.arg, 16)];
|
||||||
|
Loading…
Reference in New Issue
Block a user