Upped version number, made m() and match() aliases. Should be no noticeable changes to API.
This commit is contained in:
parent
2d4324d22b
commit
ed406281f6
|
@ -9,8 +9,8 @@ class EmailAddress extends ReParse
|
||||||
bareAddress: => @seq(@word, '@', @word).join ""
|
bareAddress: => @seq(@word, '@', @word).join ""
|
||||||
phrase: => @many @word
|
phrase: => @many @word
|
||||||
word: => @skip(/^\s+/).choice @quoted, @dottedAtom
|
word: => @skip(/^\s+/).choice @quoted, @dottedAtom
|
||||||
quoted: => @m /^"(?:\\.|[^"\r\n])+"/m
|
quoted: => @match /^"(?:\\.|[^"\r\n])+"/m
|
||||||
dottedAtom: => @m /^[!#\$%&'\*\+\-\/\w=\?\^`\{\|\}~]+(?:\.[!#\$%&'\*\+\-\/\w=\?\^`\{\|\}~]+)*/m
|
dottedAtom: => @match /^[!#\$%&'\*\+\-\/\w=\?\^`\{\|\}~]+(?:\.[!#\$%&'\*\+\-\/\w=\?\^`\{\|\}~]+)*/m
|
||||||
|
|
||||||
parse: =>
|
parse: =>
|
||||||
super
|
super
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
this.between = __bind(this.between, this);
|
this.between = __bind(this.between, this);
|
||||||
this.option = __bind(this.option, this);
|
this.option = __bind(this.option, this);
|
||||||
this.maybe = __bind(this.maybe, this);
|
this.maybe = __bind(this.maybe, this);
|
||||||
|
this.match = __bind(this.match, this);
|
||||||
this.m = __bind(this.m, this);
|
this.m = __bind(this.m, this);
|
||||||
this.start = __bind(this.start, this);
|
this.start = __bind(this.start, this);
|
||||||
this.produce = __bind(this.produce, this);
|
this.produce = __bind(this.produce, this);
|
||||||
|
@ -99,6 +100,10 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ReParse.prototype.match = function() {
|
||||||
|
return this.m.apply(this, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
ReParse.prototype.maybe = function(method) {
|
ReParse.prototype.maybe = function(method) {
|
||||||
var input;
|
var input;
|
||||||
input = this.input;
|
input = this.input;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Elf M. Sternberg"
|
"name": "Elf M. Sternberg"
|
||||||
},
|
},
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"keywords": ["parser", "coffeescript"],
|
"keywords": ["parser", "coffeescript"],
|
||||||
"licenses": [{
|
"licenses": [{
|
||||||
"type": "MIT",
|
"type": "MIT",
|
||||||
|
|
|
@ -90,6 +90,8 @@ exports.ReParse = class ReParse
|
||||||
@input = @input.substr (if probe[1]? and putback then probe[1].length else probe[0].length)
|
@input = @input.substr (if probe[1]? and putback then probe[1].length else probe[0].length)
|
||||||
if probe[1] is `undefined` then probe[0] else probe[1]
|
if probe[1] is `undefined` then probe[0] else probe[1]
|
||||||
|
|
||||||
|
match: => @m.apply this, arguments
|
||||||
|
|
||||||
# Attempts to apply the method and produce a value. If it fails,
|
# Attempts to apply the method and produce a value. If it fails,
|
||||||
# restores the input to the previous state.
|
# restores the input to the previous state.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue