Setting ordinals for literals

This commit is contained in:
Jeff Avallone 2014-12-22 15:11:37 -05:00
parent d4b648fa43
commit 9b8eef9c02
2 changed files with 5 additions and 2 deletions

View File

@ -7,7 +7,8 @@ describe('parser/javascript/literal.js', function() {
var parser = new javascript.Parser('x'); var parser = new javascript.Parser('x');
expect(parser.__consume__terminal()).toEqual(jasmine.objectContaining({ expect(parser.__consume__terminal()).toEqual(jasmine.objectContaining({
type: 'literal', type: 'literal',
literal: 'x' literal: 'x',
ordinal: 120
})); }));
}); });
@ -15,7 +16,8 @@ describe('parser/javascript/literal.js', function() {
var parser = new javascript.Parser('\\x'); var parser = new javascript.Parser('\\x');
expect(parser.__consume__terminal()).toEqual(jasmine.objectContaining({ expect(parser.__consume__terminal()).toEqual(jasmine.objectContaining({
type: 'literal', type: 'literal',
literal: 'x' literal: 'x',
ordinal: 120
})); }));
}); });

View File

@ -24,5 +24,6 @@ export default {
setup() { setup() {
this.literal = this.properties.literal.textValue; this.literal = this.properties.literal.textValue;
this.ordinal = this.literal.charCodeAt(0);
} }
}; };