• Home
  • Raw
  • Download

Lines Matching full:environment

189 def compile_rules(environment):  argument
190 """Compiles all the rules from the environment into a list of rules."""
193 (len(environment.comment_start_string), 'comment',
194 e(environment.comment_start_string)),
195 (len(environment.block_start_string), 'block',
196 e(environment.block_start_string)),
197 (len(environment.variable_start_string), 'variable',
198 e(environment.variable_start_string))
201 if environment.line_statement_prefix is not None:
202 rules.append((len(environment.line_statement_prefix), 'linestatement',
203 r'^[ \t\v]*' + e(environment.line_statement_prefix)))
204 if environment.line_comment_prefix is not None:
205 rules.append((len(environment.line_comment_prefix), 'linecomment',
207 e(environment.line_comment_prefix)))
381 def get_lexer(environment): argument
383 key = (environment.block_start_string,
384 environment.block_end_string,
385 environment.variable_start_string,
386 environment.variable_end_string,
387 environment.comment_start_string,
388 environment.comment_end_string,
389 environment.line_statement_prefix,
390 environment.line_comment_prefix,
391 environment.trim_blocks,
392 environment.lstrip_blocks,
393 environment.newline_sequence,
394 environment.keep_trailing_newline)
397 lexer = Lexer(environment)
403 """Class that implements a lexer for a given environment. Automatically
404 created by the environment class, usually you don't have to do that.
406 Note that the lexer is not automatically bound to an environment.
410 def __init__(self, environment): argument
431 root_tag_rules = compile_rules(environment)
434 block_suffix_re = environment.trim_blocks and '\\n?' or ''
438 if environment.lstrip_blocks:
442 block_diff = c(r'^%s(.*)' % e(environment.block_start_string))
444 m = block_diff.match(environment.comment_start_string)
446 m = block_diff.match(environment.variable_start_string)
450 comment_diff = c(r'^%s(.*)' % e(environment.comment_start_string))
451 m = comment_diff.match(environment.variable_start_string)
457 e(environment.block_start_string),
459 e(environment.block_start_string),
463 e(environment.comment_start_string),
465 e(environment.comment_start_string),
470 block_prefix_re = '%s' % e(environment.block_start_string)
472 self.newline_sequence = environment.newline_sequence
473 self.keep_trailing_newline = environment.keep_trailing_newline
481 e(environment.block_start_string),
483 e(environment.block_end_string),
484 e(environment.block_end_string)
495 e(environment.comment_end_string),
496 e(environment.comment_end_string),
504 e(environment.block_end_string),
505 e(environment.block_end_string),
512 e(environment.variable_end_string),
513 e(environment.variable_end_string)
519 e(environment.block_start_string),
521 e(environment.block_end_string),
522 e(environment.block_end_string),