From 9b8eef9c02c8fc5b1ecd25a918572387acf351cb Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Mon, 22 Dec 2014 15:11:37 -0500 Subject: [PATCH] Setting ordinals for literals --- spec/parser/javascript/literal_spec.js | 6 ++++-- src/js/parser/javascript/literal.js | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/parser/javascript/literal_spec.js b/spec/parser/javascript/literal_spec.js index 834080d..820e99e 100644 --- a/spec/parser/javascript/literal_spec.js +++ b/spec/parser/javascript/literal_spec.js @@ -7,7 +7,8 @@ describe('parser/javascript/literal.js', function() { var parser = new javascript.Parser('x'); expect(parser.__consume__terminal()).toEqual(jasmine.objectContaining({ type: 'literal', - literal: 'x' + literal: 'x', + ordinal: 120 })); }); @@ -15,7 +16,8 @@ describe('parser/javascript/literal.js', function() { var parser = new javascript.Parser('\\x'); expect(parser.__consume__terminal()).toEqual(jasmine.objectContaining({ type: 'literal', - literal: 'x' + literal: 'x', + ordinal: 120 })); }); diff --git a/src/js/parser/javascript/literal.js b/src/js/parser/javascript/literal.js index 95b10ca..4da90c2 100644 --- a/src/js/parser/javascript/literal.js +++ b/src/js/parser/javascript/literal.js @@ -24,5 +24,6 @@ export default { setup() { this.literal = this.properties.literal.textValue; + this.ordinal = this.literal.charCodeAt(0); } };