UNPKG

@awesome-fe/translate

Version:
31 lines 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ngInlineAtTokenizer = void 0; // Angular docs 内联的 @ 指令 function ngInlineAtTokenizer(eat, value, silent) { const matches = /^{@(\w+)\b([^}]*)}/.exec(value); if (matches) { try { if (silent || !matches) { // either we are not eating (silent) or the match failed return !!matches; } return eat(matches[0])({ type: 'ngInlineAt', name: matches[1], value: matches[2], }); } catch (e) { this.file.fail('Unmatched @ tag: ' + e.message); } } } exports.ngInlineAtTokenizer = ngInlineAtTokenizer; function locate(value, fromIndex) { const pattern = /{@(\w+)\b([^}]*)}/; pattern.lastIndex = fromIndex; return value.search(pattern); } ngInlineAtTokenizer.locator = locate; //# sourceMappingURL=ng-inline-at-tokenizer.js.map