Setting ordinal for control code escapes

This commit is contained in:
Jeff Avallone 2014-12-22 15:11:20 -05:00
parent 580af045d6
commit d4b648fa43
3 changed files with 3 additions and 3 deletions

View File

@ -19,7 +19,7 @@ describe('parser/javascript/charset_escape.js', function() {
'\\W': { label: 'non-word', ordinal: -1 },
'\\0': { label: 'null', ordinal: 0 },
'\\012': { label: 'octal: 12', ordinal: 10 },
'\\cx': { label: 'ctrl-x', ordinal: -1 },
'\\cx': { label: 'ctrl-X', ordinal: 24 },
'\\xab': { label: '0xAB', ordinal: 0xab },
'\\uabcd': { label: 'U+ABCD', ordinal: 0xabcd }
}, (content, str) => {

View File

@ -29,7 +29,7 @@ describe('parser/javascript/escape.js', function() {
'\\8': { label: 'Back reference (group = 8)', ordinal: -1 },
'\\9': { label: 'Back reference (group = 9)', ordinal: -1 },
'\\012': { label: 'octal: 12', ordinal: 10 },
'\\cx': { label: 'ctrl-x', ordinal: -1 },
'\\cx': { label: 'ctrl-X', ordinal: 24 },
'\\xab': { label: '0xAB', ordinal: 0xab },
'\\uabcd': { label: 'U+ABCD', ordinal: 0xabcd }
}, (content, str) => {

View File

@ -50,7 +50,7 @@ export default {
}
},
c() {
return [`ctrl-${this.arg}`, -1];
return [`ctrl-${this.arg.toUpperCase()}`, this.arg.toUpperCase().charCodeAt(0) - 64];
},
x() {
return [`0x${this.arg.toUpperCase()}`, parseInt(this.arg, 16)];