From c2fa26f9ede4f7b3889c8e1c02fb041aa20f4265 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Sun, 31 Jan 2016 10:54:41 -0500 Subject: [PATCH] New $Special objects for __, SOA, EOA etc. --- js/src/route.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/js/src/route.js b/js/src/route.js index 86828c8..e4297e9 100644 --- a/js/src/route.js +++ b/js/src/route.js @@ -1,9 +1,13 @@ var Immutable = require("immutable"); -var __ = "__"; /* wildcard marker */ +function $Special(name) { + this.name = name; +} -var SOA = "__["; // start of array -var EOA = "__]"; // end of array +var __ = new $Special("wildcard"); /* wildcard marker */ + +var SOA = new $Special("["); // start of array +var EOA = new $Special("]"); // end of array function die(message) { throw new Error(message); @@ -33,8 +37,8 @@ function isCapture(x) { return x instanceof $Capture || x === _$; } function captureName(x) { return x instanceof $Capture ? x.name : null; } function capturePattern(x) { return x instanceof $Capture ? x.pattern : __; } -var SOC = "__{{"; // start of capture -var EOC = "__}}"; // end of capture +var SOC = new $Special("{"); // start of capture +var EOC = new $Special("}"); // end of capture function $Success(value) { this.value = value;