Przeglądaj źródła

Remove pragma parsing optimization.

tags/0.5.0-vsc
Sahab Yazdani 15 lat temu
rodzic
commit
8e46d9004c
1 zmienionych plików z 4 dodań i 7 usunięć
  1. +4
    -7
      mustache.js

+ 4
- 7
mustache.js Wyświetl plik

@@ -207,7 +207,7 @@ var Mustache = (function(undefined) {
} }
var default_tokenizer = /(\r?\n)|({{![\s\S]*?!}})|({{[#\^\/&>]?\s*[^!{=]\S*?\s*}})|({{{\s*\S*?\s*}}})|({{=\S*?\s*\S*?=}})/; var default_tokenizer = /(\r?\n)|({{![\s\S]*?!}})|({{[#\^\/&>]?\s*[^!{=]\S*?\s*}})|({{{\s*\S*?\s*}}})|({{=\S*?\s*\S*?=}})/;
function create_compiler_state(template, partials, openTag, closeTag, parse_pragma) {
function create_compiler_state(template, partials, openTag, closeTag) {
openTag = openTag || '{{'; openTag = openTag || '{{';
closeTag = closeTag || '}}'; closeTag = closeTag || '}}';


@@ -246,9 +246,7 @@ var Mustache = (function(undefined) {
} }
}; };
if (parse_pragma!==false) { // explicit check, by default, look for pragma
pragmas(state); // use pragmas to determine parsing behaviour
}
pragmas(state); // use pragmas to control parsing behaviour
// tokenize and initialize a cursor // tokenize and initialize a cursor
state.tokens = splitFunc.call(state.template, tokenizer); state.tokens = splitFunc.call(state.template, tokenizer);
@@ -440,7 +438,7 @@ var Mustache = (function(undefined) {
var s = state.section, template = s.template_buffer.join(''), var s = state.section, template = s.template_buffer.join(''),
program, program,
new_state = create_compiler_state(template, state.partials, state.openTag, state.closeTag, false);
new_state = create_compiler_state(template, state.partials, state.openTag, state.closeTag);
new_state.metrics = s.metrics; new_state.metrics = s.metrics;
program = compile(new_state); program = compile(new_state);
@@ -544,8 +542,7 @@ var Mustache = (function(undefined) {
state.tokens.slice(state.cursor+1).join('') state.tokens.slice(state.cursor+1).join('')
, state.partials , state.partials
, matches[1] , matches[1]
, matches[2]
, false);
, matches[2]);
new_state.code = state.code; new_state.code = state.code;
new_state.send_code_func = state.send_code_func; new_state.send_code_func = state.send_code_func;
new_state.parser = state.parser; new_state.parser = state.parser;


Ładowanie…
Anuluj
Zapisz