1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-01 15:46:18 +00:00
TiddlyWiki5/core/modules/parsers/wikiparser/wikirulebase.js
2012-12-20 16:38:33 +00:00

40 lines
819 B
JavaScript

/*\
title: $:/core/modules/parsers/wikiparser/rules/wikirulebase.js
type: application/javascript
module-type: global
Base class for wiki parser rules
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
This constructor is always overridden with a blank constructor, and so shouldn't be used
*/
var WikiRuleBase = function() {
};
/*
To be overridden by individual rules
*/
WikiRuleBase.prototype.init = function(parser) {
this.parser = parser;
};
/*
Default implementation of findNextMatch uses RegExp matching
*/
WikiRuleBase.prototype.findNextMatch = function(startPos) {
this.matchRegExp.lastIndex = startPos;
this.match = this.matchRegExp.exec(this.parser.source);
return this.match ? this.match.index : undefined;
};
exports.WikiRuleBase = WikiRuleBase;
})();