• Home
  • Raw
  • Download

Lines Matching full:environment

196 def compile_rules(environment):  argument
197 """Compiles all the rules from the environment into a list of rules."""
200 (len(environment.comment_start_string), 'comment',
201 e(environment.comment_start_string)),
202 (len(environment.block_start_string), 'block',
203 e(environment.block_start_string)),
204 (len(environment.variable_start_string), 'variable',
205 e(environment.variable_start_string))
208 if environment.line_statement_prefix is not None:
209 rules.append((len(environment.line_statement_prefix), 'linestatement',
210 r'^[ \t\v]*' + e(environment.line_statement_prefix)))
211 if environment.line_comment_prefix is not None:
212 rules.append((len(environment.line_comment_prefix), 'linecomment',
214 e(environment.line_comment_prefix)))
391 def get_lexer(environment): argument
393 key = (environment.block_start_string,
394 environment.block_end_string,
395 environment.variable_start_string,
396 environment.variable_end_string,
397 environment.comment_start_string,
398 environment.comment_end_string,
399 environment.line_statement_prefix,
400 environment.line_comment_prefix,
401 environment.trim_blocks,
402 environment.lstrip_blocks,
403 environment.newline_sequence,
404 environment.keep_trailing_newline)
407 lexer = Lexer(environment)
413 """Class that implements a lexer for a given environment. Automatically
414 created by the environment class, usually you don't have to do that.
416 Note that the lexer is not automatically bound to an environment.
420 def __init__(self, environment): argument
441 root_tag_rules = compile_rules(environment)
444 block_suffix_re = environment.trim_blocks and '\\n?' or ''
448 if environment.lstrip_blocks:
452 block_diff = c(r'^%s(.*)' % e(environment.block_start_string))
454 m = block_diff.match(environment.comment_start_string)
456 m = block_diff.match(environment.variable_start_string)
460 comment_diff = c(r'^%s(.*)' % e(environment.comment_start_string))
461 m = comment_diff.match(environment.variable_start_string)
467 e(environment.block_start_string),
469 e(environment.block_start_string),
473 e(environment.comment_start_string),
475 e(environment.comment_start_string),
480 block_prefix_re = '%s' % e(environment.block_start_string)
482 self.newline_sequence = environment.newline_sequence
483 self.keep_trailing_newline = environment.keep_trailing_newline
491 e(environment.block_start_string),
493 e(environment.block_end_string),
494 e(environment.block_end_string)
505 e(environment.comment_end_string),
506 e(environment.comment_end_string),
514 e(environment.block_end_string),
515 e(environment.block_end_string),
522 e(environment.variable_end_string),
523 e(environment.variable_end_string)
529 e(environment.block_start_string),
531 e(environment.block_end_string),
532 e(environment.block_end_string),