874 aliases = ['squidconf', 'squid.conf', 'squid'] |
882 aliases = ['squidconf', 'squid.conf', 'squid'] |
875 filenames = ['squid.conf'] |
883 filenames = ['squid.conf'] |
876 mimetypes = ['text/x-squidconf'] |
884 mimetypes = ['text/x-squidconf'] |
877 flags = re.IGNORECASE |
885 flags = re.IGNORECASE |
878 |
886 |
879 keywords = [ "acl", "always_direct", "announce_host", |
887 keywords = [ |
880 "announce_period", "announce_port", "announce_to", |
888 "access_log", "acl", "always_direct", "announce_host", |
881 "anonymize_headers", "append_domain", "as_whois_server", |
889 "announce_period", "announce_port", "announce_to", "anonymize_headers", |
882 "auth_param_basic", "authenticate_children", |
890 "append_domain", "as_whois_server", "auth_param_basic", |
883 "authenticate_program", "authenticate_ttl", "broken_posts", |
891 "authenticate_children", "authenticate_program", "authenticate_ttl", |
884 "buffered_logs", "cache_access_log", "cache_announce", |
892 "broken_posts", "buffered_logs", "cache_access_log", "cache_announce", |
885 "cache_dir", "cache_dns_program", "cache_effective_group", |
893 "cache_dir", "cache_dns_program", "cache_effective_group", |
886 "cache_effective_user", "cache_host", "cache_host_acl", |
894 "cache_effective_user", "cache_host", "cache_host_acl", |
887 "cache_host_domain", "cache_log", "cache_mem", |
895 "cache_host_domain", "cache_log", "cache_mem", "cache_mem_high", |
888 "cache_mem_high", "cache_mem_low", "cache_mgr", |
896 "cache_mem_low", "cache_mgr", "cachemgr_passwd", "cache_peer", |
889 "cachemgr_passwd", "cache_peer", "cache_peer_access", |
897 "cache_peer_access", "cahce_replacement_policy", "cache_stoplist", |
890 "cahce_replacement_policy", "cache_stoplist", |
898 "cache_stoplist_pattern", "cache_store_log", "cache_swap", |
891 "cache_stoplist_pattern", "cache_store_log", "cache_swap", |
899 "cache_swap_high", "cache_swap_log", "cache_swap_low", "client_db", |
892 "cache_swap_high", "cache_swap_log", "cache_swap_low", |
900 "client_lifetime", "client_netmask", "connect_timeout", "coredump_dir", |
893 "client_db", "client_lifetime", "client_netmask", |
901 "dead_peer_timeout", "debug_options", "delay_access", "delay_class", |
894 "connect_timeout", "coredump_dir", "dead_peer_timeout", |
902 "delay_initial_bucket_level", "delay_parameters", "delay_pools", |
895 "debug_options", "delay_access", "delay_class", |
903 "deny_info", "dns_children", "dns_defnames", "dns_nameservers", |
896 "delay_initial_bucket_level", "delay_parameters", |
904 "dns_testnames", "emulate_httpd_log", "err_html_text", |
897 "delay_pools", "deny_info", "dns_children", "dns_defnames", |
905 "fake_user_agent", "firewall_ip", "forwarded_for", "forward_snmpd_port", |
898 "dns_nameservers", "dns_testnames", "emulate_httpd_log", |
906 "fqdncache_size", "ftpget_options", "ftpget_program", "ftp_list_width", |
899 "err_html_text", "fake_user_agent", "firewall_ip", |
907 "ftp_passive", "ftp_user", "half_closed_clients", "header_access", |
900 "forwarded_for", "forward_snmpd_port", "fqdncache_size", |
908 "header_replace", "hierarchy_stoplist", "high_response_time_warning", |
901 "ftpget_options", "ftpget_program", "ftp_list_width", |
909 "high_page_fault_warning", "hosts_file", "htcp_port", "http_access", |
902 "ftp_passive", "ftp_user", "half_closed_clients", |
910 "http_anonymizer", "httpd_accel", "httpd_accel_host", |
903 "header_access", "header_replace", "hierarchy_stoplist", |
911 "httpd_accel_port", "httpd_accel_uses_host_header", |
904 "high_response_time_warning", "high_page_fault_warning", |
912 "httpd_accel_with_proxy", "http_port", "http_reply_access", |
905 "htcp_port", "http_access", "http_anonymizer", "httpd_accel", |
913 "icp_access", "icp_hit_stale", "icp_port", "icp_query_timeout", |
906 "httpd_accel_host", "httpd_accel_port", |
914 "ident_lookup", "ident_lookup_access", "ident_timeout", |
907 "httpd_accel_uses_host_header", "httpd_accel_with_proxy", |
915 "incoming_http_average", "incoming_icp_average", "inside_firewall", |
908 "http_port", "http_reply_access", "icp_access", |
916 "ipcache_high", "ipcache_low", "ipcache_size", "local_domain", |
909 "icp_hit_stale", "icp_port", "icp_query_timeout", |
917 "local_ip", "logfile_rotate", "log_fqdn", "log_icp_queries", |
910 "ident_lookup", "ident_lookup_access", "ident_timeout", |
918 "log_mime_hdrs", "maximum_object_size", "maximum_single_addr_tries", |
911 "incoming_http_average", "incoming_icp_average", |
919 "mcast_groups", "mcast_icp_query_timeout", "mcast_miss_addr", |
912 "inside_firewall", "ipcache_high", "ipcache_low", |
920 "mcast_miss_encode_key", "mcast_miss_port", "memory_pools", |
913 "ipcache_size", "local_domain", "local_ip", "logfile_rotate", |
921 "memory_pools_limit", "memory_replacement_policy", "mime_table", |
914 "log_fqdn", "log_icp_queries", "log_mime_hdrs", |
922 "min_http_poll_cnt", "min_icp_poll_cnt", "minimum_direct_hops", |
915 "maximum_object_size", "maximum_single_addr_tries", |
923 "minimum_object_size", "minimum_retry_timeout", "miss_access", |
916 "mcast_groups", "mcast_icp_query_timeout", "mcast_miss_addr", |
924 "negative_dns_ttl", "negative_ttl", "neighbor_timeout", |
917 "mcast_miss_encode_key", "mcast_miss_port", "memory_pools", |
925 "neighbor_type_domain", "netdb_high", "netdb_low", "netdb_ping_period", |
918 "memory_pools_limit", "memory_replacement_policy", |
926 "netdb_ping_rate", "never_direct", "no_cache", "passthrough_proxy", |
919 "mime_table", "min_http_poll_cnt", "min_icp_poll_cnt", |
927 "pconn_timeout", "pid_filename", "pinger_program", "positive_dns_ttl", |
920 "minimum_direct_hops", "minimum_object_size", |
928 "prefer_direct", "proxy_auth", "proxy_auth_realm", "query_icmp", |
921 "minimum_retry_timeout", "miss_access", "negative_dns_ttl", |
929 "quick_abort", "quick_abort", "quick_abort_max", "quick_abort_min", |
922 "negative_ttl", "neighbor_timeout", "neighbor_type_domain", |
930 "quick_abort_pct", "range_offset_limit", "read_timeout", |
923 "netdb_high", "netdb_low", "netdb_ping_period", |
931 "redirect_children", "redirect_program", |
924 "netdb_ping_rate", "never_direct", "no_cache", |
932 "redirect_rewrites_host_header", "reference_age", "reference_age", |
925 "passthrough_proxy", "pconn_timeout", "pid_filename", |
933 "refresh_pattern", "reload_into_ims", "request_body_max_size", |
926 "pinger_program", "positive_dns_ttl", "prefer_direct", |
934 "request_size", "request_timeout", "shutdown_lifetime", |
927 "proxy_auth", "proxy_auth_realm", "query_icmp", "quick_abort", |
935 "single_parent_bypass", "siteselect_timeout", "snmp_access", |
928 "quick_abort", "quick_abort_max", "quick_abort_min", |
936 "snmp_incoming_address", "snmp_port", "source_ping", "ssl_proxy", |
929 "quick_abort_pct", "range_offset_limit", "read_timeout", |
937 "store_avg_object_size", "store_objects_per_bucket", |
930 "redirect_children", "redirect_program", |
938 "strip_query_terms", "swap_level1_dirs", "swap_level2_dirs", |
931 "redirect_rewrites_host_header", "reference_age", |
939 "tcp_incoming_address", "tcp_outgoing_address", "tcp_recv_bufsize", |
932 "reference_age", "refresh_pattern", "reload_into_ims", |
940 "test_reachability", "udp_hit_obj", "udp_hit_obj_size", |
933 "request_body_max_size", "request_size", "request_timeout", |
941 "udp_incoming_address", "udp_outgoing_address", "unique_hostname", |
934 "shutdown_lifetime", "single_parent_bypass", |
942 "unlinkd_program", "uri_whitespace", "useragent_log", |
935 "siteselect_timeout", "snmp_access", "snmp_incoming_address", |
943 "visible_hostname", "wais_relay", "wais_relay_host", "wais_relay_port", |
936 "snmp_port", "source_ping", "ssl_proxy", |
944 ] |
937 "store_avg_object_size", "store_objects_per_bucket", |
945 |
938 "strip_query_terms", "swap_level1_dirs", "swap_level2_dirs", |
946 opts = [ |
939 "tcp_incoming_address", "tcp_outgoing_address", |
947 "proxy-only", "weight", "ttl", "no-query", "default", "round-robin", |
940 "tcp_recv_bufsize", "test_reachability", "udp_hit_obj", |
948 "multicast-responder", "on", "off", "all", "deny", "allow", "via", |
941 "udp_hit_obj_size", "udp_incoming_address", |
949 "parent", "no-digest", "heap", "lru", "realm", "children", "q1", "q2", |
942 "udp_outgoing_address", "unique_hostname", "unlinkd_program", |
950 "credentialsttl", "none", "disable", "offline_toggle", "diskd", |
943 "uri_whitespace", "useragent_log", "visible_hostname", |
951 ] |
944 "wais_relay", "wais_relay_host", "wais_relay_port", |
952 |
945 ] |
953 actions = [ |
946 |
954 "shutdown", "info", "parameter", "server_list", "client_list", |
947 opts = [ "proxy-only", "weight", "ttl", "no-query", "default", |
955 r'squid\.conf', |
948 "round-robin", "multicast-responder", "on", "off", "all", |
956 ] |
949 "deny", "allow", "via", "parent", "no-digest", "heap", "lru", |
957 |
950 "realm", "children", "credentialsttl", "none", "disable", |
958 actions_stats = [ |
951 "offline_toggle", "diskd", "q1", "q2", |
959 "objects", "vm_objects", "utilization", "ipcache", "fqdncache", "dns", |
952 ] |
960 "redirector", "io", "reply_headers", "filedescriptors", "netdb", |
953 |
961 ] |
954 actions = [ "shutdown", "info", "parameter", "server_list", |
962 |
955 "client_list", r'squid\.conf', |
963 actions_log = ["status", "enable", "disable", "clear"] |
956 ] |
964 |
957 |
965 acls = [ |
958 actions_stats = [ "objects", "vm_objects", "utilization", |
966 "url_regex", "urlpath_regex", "referer_regex", "port", "proto", |
959 "ipcache", "fqdncache", "dns", "redirector", "io", |
967 "req_mime_type", "rep_mime_type", "method", "browser", "user", "src", |
960 "reply_headers", "filedescriptors", "netdb", |
968 "dst", "time", "dstdomain", "ident", "snmp_community", |
961 ] |
969 ] |
962 |
970 |
963 actions_log = [ "status", "enable", "disable", "clear"] |
971 ip_re = ( |
964 |
972 r'(?:(?:(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|0x0*[0-9a-f]{1,2}|' |
965 acls = [ "url_regex", "urlpath_regex", "referer_regex", "port", |
973 r'0+[1-3]?[0-7]{0,2})(?:\.(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|' |
966 "proto", "req_mime_type", "rep_mime_type", "method", |
974 r'0x0*[0-9a-f]{1,2}|0+[1-3]?[0-7]{0,2})){3})|(?!.*::.*::)(?:(?!:)|' |
967 "browser", "user", "src", "dst", "time", "dstdomain", "ident", |
975 r':(?=:))(?:[0-9a-f]{0,4}(?:(?<=::)|(?<!::):)){6}(?:[0-9a-f]{0,4}' |
968 "snmp_community", |
976 r'(?:(?<=::)|(?<!::):)[0-9a-f]{0,4}(?:(?<=::)|(?<!:)|(?<=:)(?<!::):)|' |
969 ] |
977 r'(?:25[0-4]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-4]|2[0-4]\d|1\d\d|' |
970 |
978 r'[1-9]?\d)){3}))' |
971 ip_re = r'\b(?:\d{1,3}\.){3}\d{1,3}\b' |
979 ) |
972 |
980 |
973 def makelistre(list): |
981 def makelistre(list): |
974 return r'\b(?:'+'|'.join(list)+r')\b' |
982 return r'\b(?:' + '|'.join(list) + r')\b' |
975 |
983 |
976 tokens = { |
984 tokens = { |
977 'root': [ |
985 'root': [ |
978 (r'\s+', Text), |
986 (r'\s+', Whitespace), |
979 (r'#', Comment, 'comment'), |
987 (r'#', Comment, 'comment'), |
980 (makelistre(keywords), Keyword), |
988 (makelistre(keywords), Keyword), |
981 (makelistre(opts), Name.Constant), |
989 (makelistre(opts), Name.Constant), |
982 # Actions |
990 # Actions |
983 (makelistre(actions), String), |
991 (makelistre(actions), String), |
984 (r'stats/'+makelistre(actions), String), |
992 (r'stats/'+makelistre(actions), String), |
985 (r'log/'+makelistre(actions)+r'=', String), |
993 (r'log/'+makelistre(actions)+r'=', String), |
986 (makelistre(acls), Keyword), |
994 (makelistre(acls), Keyword), |
987 (ip_re+r'(?:/(?:'+ip_re+r')|\d+)?', Number), |
995 (ip_re + r'(?:/(?:' + ip_re + r'|\b\d+\b))?', Number.Float), |
988 (r'\b\d+\b', Number), |
996 (r'(?:\b\d+\b(?:-\b\d+|%)?)', Number), |
989 (r'\S+', Text), |
997 (r'\S+', Text), |
990 ], |
998 ], |
991 'comment': [ |
999 'comment': [ |
992 (r'\s*TAG:.*', String.Escape, '#pop'), |
1000 (r'\s*TAG:.*', String.Escape, '#pop'), |
993 (r'.*', Comment, '#pop'), |
1001 (r'.*', Comment, '#pop'), |
1604 (r'[ \t]+', Text), |
1615 (r'[ \t]+', Text), |
1605 (r'#.+\n', Comment), |
1616 (r'#.+\n', Comment), |
1606 ] |
1617 ] |
1607 } |
1618 } |
1608 |
1619 |
|
1620 |
|
1621 class HttpLexer(RegexLexer): |
|
1622 """ |
|
1623 Lexer for HTTP sessions. |
|
1624 |
|
1625 *New in Pygments 1.5.* |
|
1626 """ |
|
1627 |
|
1628 name = 'HTTP' |
|
1629 aliases = ['http'] |
|
1630 |
|
1631 flags = re.DOTALL |
|
1632 |
|
1633 def header_callback(self, match): |
|
1634 if match.group(1).lower() == 'content-type': |
|
1635 content_type = match.group(5).strip() |
|
1636 if ';' in content_type: |
|
1637 content_type = content_type[:content_type.find(';')].strip() |
|
1638 self.content_type = content_type |
|
1639 yield match.start(1), Name.Attribute, match.group(1) |
|
1640 yield match.start(2), Text, match.group(2) |
|
1641 yield match.start(3), Operator, match.group(3) |
|
1642 yield match.start(4), Text, match.group(4) |
|
1643 yield match.start(5), Literal, match.group(5) |
|
1644 yield match.start(6), Text, match.group(6) |
|
1645 |
|
1646 def content_callback(self, match): |
|
1647 content_type = getattr(self, 'content_type', None) |
|
1648 content = match.group() |
|
1649 offset = match.start() |
|
1650 if content_type: |
|
1651 from pygments.lexers import get_lexer_for_mimetype |
|
1652 try: |
|
1653 lexer = get_lexer_for_mimetype(content_type) |
|
1654 except ClassNotFound: |
|
1655 pass |
|
1656 else: |
|
1657 for idx, token, value in lexer.get_tokens_unprocessed(content): |
|
1658 yield offset + idx, token, value |
|
1659 return |
|
1660 yield offset, Text, content |
|
1661 |
|
1662 tokens = { |
|
1663 'root': [ |
|
1664 (r'(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE)( +)([^ ]+)( +)' |
|
1665 r'(HTTPS?)(/)(1\.[01])(\r?\n|$)', |
|
1666 bygroups(Name.Function, Text, Name.Namespace, Text, |
|
1667 Keyword.Reserved, Operator, Number, Text), |
|
1668 'headers'), |
|
1669 (r'(HTTPS?)(/)(1\.[01])( +)(\d{3})( +)([^\r\n]+)(\r?\n|$)', |
|
1670 bygroups(Keyword.Reserved, Operator, Number, Text, Number, |
|
1671 Text, Name.Exception, Text), |
|
1672 'headers'), |
|
1673 ], |
|
1674 'headers': [ |
|
1675 (r'([^\s:]+)( *)(:)( *)([^\r\n]+)(\r?\n|$)', header_callback), |
|
1676 (r'\r?\n', Text, 'content') |
|
1677 ], |
|
1678 'content': [ |
|
1679 (r'.+', content_callback) |
|
1680 ] |
|
1681 } |
|
1682 |
|
1683 |
|
1684 class PyPyLogLexer(RegexLexer): |
|
1685 """ |
|
1686 Lexer for PyPy log files. |
|
1687 |
|
1688 *New in Pygments 1.5.* |
|
1689 """ |
|
1690 name = "PyPy Log" |
|
1691 aliases = ["pypylog", "pypy"] |
|
1692 filenames = ["*.pypylog"] |
|
1693 mimetypes = ['application/x-pypylog'] |
|
1694 |
|
1695 tokens = { |
|
1696 "root": [ |
|
1697 (r"\[\w+\] {jit-log-.*?$", Keyword, "jit-log"), |
|
1698 (r"\[\w+\] {jit-backend-counts$", Keyword, "jit-backend-counts"), |
|
1699 include("extra-stuff"), |
|
1700 ], |
|
1701 "jit-log": [ |
|
1702 (r"\[\w+\] jit-log-.*?}$", Keyword, "#pop"), |
|
1703 |
|
1704 (r"^\+\d+: ", Comment), |
|
1705 (r"[ifp]\d+", Name), |
|
1706 (r"ptr\d+", Name), |
|
1707 (r"(\()(\w+(?:\.\w+)?)(\))", |
|
1708 bygroups(Punctuation, Name.Builtin, Punctuation)), |
|
1709 (r"[\[\]=,()]", Punctuation), |
|
1710 (r"(\d+\.\d+|inf|-inf)", Number.Float), |
|
1711 (r"-?\d+", Number.Integer), |
|
1712 (r"'.*'", String), |
|
1713 (r"(None|descr|ConstClass|ConstPtr|TargetToken)", Name), |
|
1714 (r"<.*?>", Name.Builtin), |
|
1715 (r"(label|debug_merge_point|jump|finish)", Name.Class), |
|
1716 (r"(int_add_ovf|int_add|int_sub_ovf|int_sub|int_mul_ovf|int_mul|" |
|
1717 r"int_floordiv|int_mod|int_lshift|int_rshift|int_and|int_or|" |
|
1718 r"int_xor|int_eq|int_ne|int_ge|int_gt|int_le|int_lt|int_is_zero|" |
|
1719 r"int_is_true|" |
|
1720 r"uint_floordiv|uint_ge|uint_lt|" |
|
1721 r"float_add|float_sub|float_mul|float_truediv|" |
|
1722 r"float_eq|float_ne|float_ge|float_gt|float_le|float_lt|float_abs|" |
|
1723 r"ptr_eq|ptr_ne|instance_ptr_eq|instance_ptr_ne|" |
|
1724 r"cast_int_to_float|cast_float_to_int|" |
|
1725 r"force_token|quasiimmut_field|same_as|virtual_ref_finish|" |
|
1726 r"virtual_ref|mark_opaque_ptr|" |
|
1727 r"call_may_force|call_assembler|call_loopinvariant|" |
|
1728 r"call_release_gil|call_pure|call|" |
|
1729 r"new_with_vtable|new_array|newstr|newunicode|new|" |
|
1730 r"arraylen_gc|" |
|
1731 r"getarrayitem_gc_pure|getarrayitem_gc|setarrayitem_gc|" |
|
1732 r"getarrayitem_raw|setarrayitem_raw|getfield_gc_pure|" |
|
1733 r"getfield_gc|getinteriorfield_gc|setinteriorfield_gc|" |
|
1734 r"getfield_raw|setfield_gc|setfield_raw|" |
|
1735 r"strgetitem|strsetitem|strlen|copystrcontent|" |
|
1736 r"unicodegetitem|unicodesetitem|unicodelen|" |
|
1737 r"guard_true|guard_false|guard_value|guard_isnull|" |
|
1738 r"guard_nonnull_class|guard_nonnull|guard_class|guard_no_overflow|" |
|
1739 r"guard_not_forced|guard_no_exception|guard_not_invalidated)", |
|
1740 Name.Builtin), |
|
1741 include("extra-stuff"), |
|
1742 ], |
|
1743 "jit-backend-counts": [ |
|
1744 (r"\[\w+\] jit-backend-counts}$", Keyword, "#pop"), |
|
1745 (r":", Punctuation), |
|
1746 (r"\d+", Number), |
|
1747 include("extra-stuff"), |
|
1748 ], |
|
1749 "extra-stuff": [ |
|
1750 (r"\s+", Text), |
|
1751 (r"#.*?$", Comment), |
|
1752 ], |
|
1753 } |