From 1ffcd785f85c36a31fbf1a963c0f3c8c4f8516a5 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Tue, 2 Dec 2014 19:59:10 -0500 Subject: [PATCH] Changing names of grammar elements. Starting with an "_" will prevent collisions with extensions --- src/js/parser/javascript/grammar.peg | 8 +++++--- src/js/parser/javascript/regexp.js | 2 +- src/js/parser/javascript/root.js | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/js/parser/javascript/grammar.peg b/src/js/parser/javascript/grammar.peg index c7311b6..f0eb426 100644 --- a/src/js/parser/javascript/grammar.peg +++ b/src/js/parser/javascript/grammar.peg @@ -1,7 +1,9 @@ grammar JavascriptRegexp - root <- ( ( "/" regexp "/" fl:[igm]* ) / regexp ""? ) - regexp <- match alternates:( "|" match )* - match <- anchor_start? ( ( subexp / charset / terminal ) repeat? )* anchor_end? + root <- ( ( "/" regexp "/" _flags:[igm]* ) / regexp ""? ) + regexp <- _match:match _alternates:( "|" match )* + match <- _anchor_start:anchor_start? + _parts:( ( subexp / charset / terminal ) repeat? )* + _anchor_end:anchor_end? anchor_start <- "^" anchor_end <- "$" repeat <- ( repeat_any / repeat_required / repeat_optional / repeat_spec ) repeat_greedy? diff --git a/src/js/parser/javascript/regexp.js b/src/js/parser/javascript/regexp.js index 97b6e2c..9b08a0d 100644 --- a/src/js/parser/javascript/regexp.js +++ b/src/js/parser/javascript/regexp.js @@ -60,6 +60,6 @@ export default _.extend({}, Base, { }, matches() { - return [this.match].concat(_.map(this.alternates.elements, _.property('match'))); + return [this._match].concat(_.map(this._alternates.elements, _.property('match'))); } }); diff --git a/src/js/parser/javascript/root.js b/src/js/parser/javascript/root.js index 3969101..960ec31 100644 --- a/src/js/parser/javascript/root.js +++ b/src/js/parser/javascript/root.js @@ -33,8 +33,8 @@ export default _.extend({}, Base, { flags() { var flags; - if (this.fl) { - flags = this.fl.textValue; + if (this._flags) { + flags = this._flags.textValue; } else { flags = ''; }