本文整理汇总了TypeScript中@core/util/reporters.parser_warn函数的典型用法代码示例。如果您正苦于以下问题:TypeScript parser_warn函数的具体用法?TypeScript parser_warn怎么用?TypeScript parser_warn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parser_warn函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: cursor_groupEnd
export function cursor_groupEnd (str, i, imax, startCode, endCode){
var count = 0,
start = i,
c;
for( ; i < imax; i++){
c = str.charCodeAt(i);
if (c === 34 || c === 39) {
// "|'
i = cursor_quoteEnd(
str
, i + 1
, imax
, c === 34 ? '"' : "'"
);
continue;
}
if (c === startCode) {
count++;
continue;
}
if (c === endCode) {
if (--count === -1)
return i;
}
}
parser_warn('Group was not closed', str, start);
return imax;
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:28,代码来源:cursor.ts
示例2: unicode_toChar
function unicode_toChar(unicode) {
var num = Number('0' + unicode);
if (num !== num) {
parser_warn('Invalid Unicode Char', unicode);
return '';
}
return String.fromCharCode(num);
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:8,代码来源:parser.ts
示例3: cursor_quoteEnd
export function cursor_quoteEnd (str, i, imax, char_){
var start = i;
while ((i = str.indexOf(char_, i)) !== -1) {
if (str.charCodeAt(i - 1) !== 92 /*\*/){
return i;
}
i++;
}
parser_warn('Quote was not closed', str, start - 1);
return imax;
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:11,代码来源:cursor.ts
示例4: parser_parseLiteral
export function parser_parseLiteral (str, start, imax){
var i = cursor_skipWhitespace(str, start, imax);
var c = str.charCodeAt(i);
if (c !== 34 && c !== 39) {
// "'
parser_error("A quote is expected", str, i);
return null;
}
var isEscaped = false,
isUnescapedBlock = false,
_char = c === 39 ? "'" : '"';
start = ++i;
while ((i = str.indexOf(_char, i)) > -1) {
if (str.charCodeAt(i - 1) !== 92 /*'\\'*/ ) {
break;
}
isEscaped = true;
i++;
}
if (i === -1) {
parser_warn('Literal has no ending', str, start - 1);
i = imax;
}
if (i === start) {
var nextC = str.charCodeAt(i + 1);
if (nextC === c) {
isUnescapedBlock = true;
start = i + 2;
i = str.indexOf(_char + _char + _char, start);
if (i === -1)
i = imax;
}
}
var token = str.substring(start, i);
if (isEscaped === true) {
token = token.replace(__rgxEscapedChar[_char], _char);
}
i += isUnescapedBlock ? 3 : 1;
return [ token, i ];
};
开发者ID:atmajs,项目名称:MaskJS,代码行数:47,代码来源:literal.ts
示例5: tag_Close
function tag_Close(current, name) {
if (SINGLE_TAGS[name] === 1) {
// donothing
return current;
}
var x = current;
while(x != null) {
if (x.tagName != null && x.tagName.toLowerCase() === name) {
break;
}
x = x.parent;
}
if (x == null) {
parser_warn('Unmatched closing tag', name);
return current;
}
return x.parent || x;
}
开发者ID:atmajs,项目名称:MaskJS,代码行数:19,代码来源:parser.ts
示例6: parser_parseHtmlPartial
export function parser_parseHtmlPartial (str, index, exitEarly) {
var current:any = new Dom.HtmlFragment(),
fragment = current,
state = go_tag,
i = index,
imax = str.length,
token,
c, // charCode
start;
outer: while (i <= imax) {
if (state === state_literal && current === fragment && exitEarly === true) {
return [ fragment, i, 0 ];
}
if (state === state_attr) {
i = parser_parseAttrObject(str, i, imax, current.attr);
if (i === imax) {
break;
}
handleNodeAttributes(current);
switch (char_(str, i)) {
case 47: // /
current = current.parent;
i = until_(str, i, imax, 62);
break;
case 62: // >
if (SINGLE_TAGS[current.tagName.toLowerCase()] === 1) {
current = current.parent;
}
break;
}
i++;
var tagName = current.tagName;
if (tagName === 'mask' || parser_cfg_ContentTags[tagName] === 1) {
var result = _extractContent(str, i, tagName);
var txt = result[0];
i = result[1];
if (tagName === 'mask') {
current.parent.nodes.pop();
current = current.parent;
var mix = parser_parse(txt);
if (mix.type !== Dom.FRAGMENT) {
var maskFrag = new Dom.Fragment();
maskFrag.appendChild(mix);
mix = maskFrag;
}
current.appendChild(mix);
} else {
current.appendChild(new Dom.TextNode(result[0]));
current = current.parent;
}
}
state = state_literal;
continue outer;
}
c = char_(str, i);
if (c === 60) {
//<
c = char_(str, ++i)
if (c === 33 /*!*/) {
if (char_(str, i + 1) === 45 && char_(str, i + 2) === 45) {
//-- COMMENT
i = str.indexOf('-->', i + 3) + 3;
if (i === 2) {
//#if (DEBUG)
parser_warn('Comment has no ending', str, i);
//#endif
i = imax;
}
state = state_literal;
continue outer;
}
if (str.substring(i + 1, i + 1 + CDATA.length).toUpperCase() === CDATA) {
// CDATA
start = i + 1 + CDATA.length;
i = str.indexOf(']]>', start);
if (i === -1) i = imax;
current.appendChild(new Dom.TextNode(str.substring(start, i)));
i += 3;
state = state_literal;
continue outer;
}
if (str.substring(i + 1, i + 1 + DOCTYPE.length).toUpperCase() === DOCTYPE) {
// DOCTYPE
var doctype = new Dom.Node('!' + DOCTYPE, current);
doctype.attr.html = 'html';
current.appendChild(doctype);
i = until_(str, i, imax, 62) + 1;
state = state_literal;
continue outer;
}
}
if (c === 36 || c === 95 || c === 58 || c === 43 || c === 47 || (65 <= c && c <= 90) || (97 <= c && c <= 122)) {
// $_:+/ A-Z a-z
if (c === 47 /*/*/) {
state = state_closeTag;
//.........这里部分代码省略.........
开发者ID:atmajs,项目名称:MaskJS,代码行数:101,代码来源:parser.ts
示例7: parser_parse
export function parser_parse(template, filename?) {
var current: any = new Dom.Fragment(),
fragment = current,
state = go_tag,
last = state_tag,
index = 0,
length = template.length,
classNames,
token,
tokenIndex,
key,
value,
next,
c, // charCode
start,
nextC,
sourceIndex;
fragment.source = template;
fragment.filename = filename;
outer: while (true) {
while (index < length && (c = template.charCodeAt(index)) < 33) {
index++;
}
// COMMENTS
if (c === 47) {
// /
nextC = template.charCodeAt(index + 1);
if (nextC === 47) {
// inline (/)
index++;
while (c !== 10 && c !== 13 && index < length) {
// goto newline
c = template.charCodeAt(++index);
}
continue;
}
if (nextC === 42) {
// block (*)
index = template.indexOf('*/', index + 2) + 2;
if (index === 1) {
// if DEBUG
parser_warn('Block comment has no ending', template, index);
// endif
index = length;
}
continue;
}
}
if (last === state_attr) {
if (classNames != null) {
current.attr['class'] = parser_ensureTemplateFunction(classNames);
classNames = null;
}
if (key != null) {
current.attr[key] = key;
key = null;
token = null;
}
}
if (token != null) {
if (state === state_attr) {
if (key == null) {
key = token;
} else {
value = token;
}
if (key != null && value != null) {
if (key !== 'class') {
current.attr[key] = value;
} else {
classNames = classNames == null ? value : classNames + ' ' + value;
}
key = null;
value = null;
}
}
else if (state === go_propVal) {
if (key == null || token == null) {
parser_warn('Unexpected property value state', template, index, c, state);
}
if (current.props == null) {
current.props = {};
}
current.props[key] = token;
state = state_attr;
last = go_propVal;
token = null;
key = null;
continue;
}
else if (last === state_tag) {
//.........这里部分代码省略.........
开发者ID:atmajs,项目名称:MaskJS,代码行数:101,代码来源:parser.ts
注:本文中的@core/util/reporters.parser_warn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论