<s> """<STR_LIT>""" <EOL> from . import TokenParser <EOL> from . . compat import u <EOL> """<STR_LIT>""" <EOL> KEYWORDS = [ <EOL> '<STR_LIT:_>' , <EOL> '<STR_LIT:$>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT:m>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] <EOL> class LassoJavascriptParser ( TokenParser ) : <EOL> def parse ( self ) : <EOL> for index , token , content in self . tokens : <EOL> self . _process_token ( token , content ) <EOL> return self . dependencies <EOL> def _process_token ( self , token , content ) : <EOL> if u ( token ) == '<STR_LIT>' : <EOL> self . _process_name ( token , content ) <EOL> elif u ( token ) == '<STR_LIT>' or u ( token ) == '<STR_LIT>' : <EOL> self . _process_literal_string ( token , content ) <EOL> def _process_name ( self , token , content ) : <EOL> if content . lower ( ) in KEYWORDS : <EOL> self . append ( content . lower ( ) ) <EOL> def _process_literal_string ( self , token , content ) : <EOL> if '<STR_LIT>' in content . strip ( '<STR_LIT:">' ) . strip ( "<STR_LIT:'>" ) : <EOL> self . append ( '<STR_LIT>' ) <EOL> class HtmlDjangoParser ( TokenParser ) : <EOL> tags = [ ] <EOL> getting_attrs = False <EOL> current_attr = None <EOL> current_attr_value = None <EOL> def parse ( self ) : <EOL> for index , token , content in self . tokens : <EOL> self . _process_token ( token , content ) <EOL> return self . dependencies <EOL> def _process_token ( self , token , content ) : <EOL> if u ( token ) == '<STR_LIT>' : <EOL> self . _process_tag ( token , content ) <EOL> elif u ( token ) == '<STR_LIT>' : <EOL> self . _process_string ( token , content ) <EOL> elif u ( token ) == '<STR_LIT>' : <EOL> self . _process_attribute ( token , content ) <EOL> @ property <EOL> def current_tag ( self ) : <EOL> return None if len ( self . tags ) == <NUM_LIT:0> else self . tags [ <NUM_LIT:0> ] <EOL> def _process_tag ( self , token , content ) : <EOL> if content . startswith ( '<STR_LIT>' ) or content . startswith ( '<STR_LIT:/>' ) : <EOL> try : <EOL> self . tags . pop ( <NUM_LIT:0> ) <EOL> except IndexError : <EOL> pass <EOL> self . getting_attrs = False <EOL> elif content . startswith ( '<STR_LIT:<>' ) : <EOL> self . tags . insert ( <NUM_LIT:0> , content . replace ( '<STR_LIT:<>' , '<STR_LIT>' , <NUM_LIT:1> ) . strip ( ) . lower ( ) ) <EOL> self . getting_attrs = True <EOL> elif content . startswith ( '<STR_LIT:>>' ) : <EOL> self . getting_attrs = False <EOL> self . current_attr = None <EOL> def _process_attribute ( self , token , content ) : <EOL> if self . getting_attrs : <EOL> self . current_attr = content . lower ( ) . strip ( '<STR_LIT:=>' ) <EOL> else : <EOL> self . current_attr = None <EOL> self . current_attr_value = None <EOL> def _process_string ( self , token , content ) : <EOL> if self . getting_attrs and self . current_attr is not None : <EOL> if content . endswith ( '<STR_LIT:">' ) or content . endswith ( "<STR_LIT:'>" ) : <EOL> if self . current_attr_value is not None : <EOL> self . current_attr_value += content <EOL> if self . current_tag == '<STR_LIT>' and self . current_attr == '<STR_LIT:src>' : <EOL> self . append ( self . current_attr_value ) <EOL> self . current_attr = None <EOL> self . current_attr_value = None <EOL> else : <EOL> if len ( content ) == <NUM_LIT:1> : <EOL> self . current_attr_value = content <EOL> else : <EOL> if self . current_tag == '<STR_LIT>' and self . current_attr == '<STR_LIT:src>' : <EOL> self . append ( content ) <EOL> self . current_attr = None <EOL> self . current_attr_value = None <EOL> elif content . startswith ( '<STR_LIT:">' ) or content . startswith ( "<STR_LIT:'>" ) : <EOL> if self . current_attr_value is None : <EOL> self . current_attr_value = content <EOL> else : <EOL> self . current_attr_value += content <EOL> class VelocityHtmlParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class MyghtyHtmlParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class MasonParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class MakoHtmlParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class CheetahHtmlParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class HtmlGenshiParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class RhtmlParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class HtmlPhpParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class HtmlSmartyParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class EvoqueHtmlParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class ColdfusionHtmlParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class LassoHtmlParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class HandlebarsHtmlParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class YamlJinjaParser ( HtmlDjangoParser ) : <EOL> pass <EOL> class TwigHtmlParser ( HtmlDjangoParser ) : <EOL> pass </s>
