pygments.rb 0.2.4 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/lib/pygments/version.rb +1 -1
  2. data/vendor/pygments-main/AUTHORS +14 -0
  3. data/vendor/pygments-main/CHANGES +34 -3
  4. data/vendor/pygments-main/Makefile +1 -1
  5. data/vendor/pygments-main/docs/generate.py +1 -1
  6. data/vendor/pygments-main/external/markdown-processor.py +1 -1
  7. data/vendor/pygments-main/external/moin-parser.py +1 -1
  8. data/vendor/pygments-main/external/rst-directive-old.py +1 -1
  9. data/vendor/pygments-main/external/rst-directive.py +1 -1
  10. data/vendor/pygments-main/pygments/__init__.py +1 -1
  11. data/vendor/pygments-main/pygments/cmdline.py +4 -1
  12. data/vendor/pygments-main/pygments/console.py +1 -1
  13. data/vendor/pygments-main/pygments/filter.py +1 -1
  14. data/vendor/pygments-main/pygments/filters/__init__.py +1 -1
  15. data/vendor/pygments-main/pygments/formatter.py +1 -1
  16. data/vendor/pygments-main/pygments/formatters/__init__.py +1 -1
  17. data/vendor/pygments-main/pygments/formatters/_mapping.py +1 -1
  18. data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
  19. data/vendor/pygments-main/pygments/formatters/html.py +2 -2
  20. data/vendor/pygments-main/pygments/formatters/img.py +1 -1
  21. data/vendor/pygments-main/pygments/formatters/latex.py +3 -2
  22. data/vendor/pygments-main/pygments/formatters/other.py +1 -1
  23. data/vendor/pygments-main/pygments/formatters/rtf.py +1 -1
  24. data/vendor/pygments-main/pygments/formatters/svg.py +1 -1
  25. data/vendor/pygments-main/pygments/formatters/terminal.py +5 -2
  26. data/vendor/pygments-main/pygments/formatters/terminal256.py +5 -2
  27. data/vendor/pygments-main/pygments/lexer.py +29 -10
  28. data/vendor/pygments-main/pygments/lexers/__init__.py +14 -11
  29. data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1 -1
  30. data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +1 -1
  31. data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +1 -1
  32. data/vendor/pygments-main/pygments/lexers/_mapping.py +41 -23
  33. data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +1 -1
  34. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +1 -1
  35. data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +29 -0
  36. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +3 -3
  37. data/vendor/pygments-main/pygments/lexers/agile.py +148 -443
  38. data/vendor/pygments-main/pygments/lexers/asm.py +5 -3
  39. data/vendor/pygments-main/pygments/lexers/compiled.py +298 -294
  40. data/vendor/pygments-main/pygments/lexers/dotnet.py +40 -34
  41. data/vendor/pygments-main/pygments/lexers/functional.py +723 -4
  42. data/vendor/pygments-main/pygments/lexers/hdl.py +228 -6
  43. data/vendor/pygments-main/pygments/lexers/jvm.py +678 -0
  44. data/vendor/pygments-main/pygments/lexers/math.py +65 -2
  45. data/vendor/pygments-main/pygments/lexers/other.py +875 -481
  46. data/vendor/pygments-main/pygments/lexers/parsers.py +1 -1
  47. data/vendor/pygments-main/pygments/lexers/shell.py +360 -0
  48. data/vendor/pygments-main/pygments/lexers/special.py +1 -1
  49. data/vendor/pygments-main/pygments/lexers/sql.py +565 -0
  50. data/vendor/pygments-main/pygments/lexers/templates.py +1 -1
  51. data/vendor/pygments-main/pygments/lexers/text.py +237 -100
  52. data/vendor/pygments-main/pygments/lexers/web.py +146 -10
  53. data/vendor/pygments-main/pygments/plugin.py +1 -1
  54. data/vendor/pygments-main/pygments/scanner.py +1 -1
  55. data/vendor/pygments-main/pygments/style.py +1 -1
  56. data/vendor/pygments-main/pygments/styles/__init__.py +2 -1
  57. data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
  58. data/vendor/pygments-main/pygments/styles/borland.py +1 -1
  59. data/vendor/pygments-main/pygments/styles/bw.py +1 -1
  60. data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
  61. data/vendor/pygments-main/pygments/styles/default.py +1 -1
  62. data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
  63. data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
  64. data/vendor/pygments-main/pygments/styles/fruity.py +1 -2
  65. data/vendor/pygments-main/pygments/styles/manni.py +1 -1
  66. data/vendor/pygments-main/pygments/styles/monokai.py +1 -1
  67. data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
  68. data/vendor/pygments-main/pygments/styles/native.py +1 -1
  69. data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
  70. data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
  71. data/vendor/pygments-main/pygments/styles/rrt.py +33 -0
  72. data/vendor/pygments-main/pygments/styles/tango.py +1 -1
  73. data/vendor/pygments-main/pygments/styles/trac.py +1 -1
  74. data/vendor/pygments-main/pygments/styles/vim.py +1 -1
  75. data/vendor/pygments-main/pygments/styles/vs.py +1 -1
  76. data/vendor/pygments-main/pygments/token.py +1 -1
  77. data/vendor/pygments-main/pygments/unistring.py +1 -1
  78. data/vendor/pygments-main/pygments/util.py +2 -2
  79. data/vendor/pygments-main/scripts/check_sources.py +2 -2
  80. data/vendor/pygments-main/scripts/find_codetags.py +1 -1
  81. data/vendor/pygments-main/scripts/find_error.py +5 -2
  82. data/vendor/pygments-main/scripts/get_vimkw.py +9 -4
  83. data/vendor/pygments-main/setup.py +1 -1
  84. data/vendor/pygments-main/tests/examplefiles/classes.dylan +16 -0
  85. data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +447 -0
  86. data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
  87. data/vendor/pygments-main/tests/examplefiles/example.moon +629 -0
  88. data/vendor/pygments-main/tests/examplefiles/example.p +34 -0
  89. data/vendor/pygments-main/tests/examplefiles/example.snobol +15 -0
  90. data/vendor/pygments-main/tests/examplefiles/example.u +548 -0
  91. data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +363 -0
  92. data/vendor/pygments-main/tests/examplefiles/foo.sce +6 -0
  93. data/vendor/pygments-main/tests/examplefiles/http_request_example +14 -0
  94. data/vendor/pygments-main/tests/examplefiles/http_response_example +27 -0
  95. data/vendor/pygments-main/tests/examplefiles/irc.lsp +214 -0
  96. data/vendor/pygments-main/tests/examplefiles/markdown.lsp +679 -0
  97. data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +4 -2
  98. data/vendor/pygments-main/tests/examplefiles/reversi.lsp +427 -0
  99. data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
  100. data/vendor/pygments-main/tests/examplefiles/test.bro +250 -0
  101. data/vendor/pygments-main/tests/examplefiles/test.cs +23 -0
  102. data/vendor/pygments-main/tests/examplefiles/test.dart +23 -0
  103. data/vendor/pygments-main/tests/examplefiles/test.ecl +58 -0
  104. data/vendor/pygments-main/tests/examplefiles/test.fan +818 -0
  105. data/vendor/pygments-main/tests/examplefiles/test.ps1 +108 -0
  106. data/vendor/pygments-main/tests/examplefiles/test.vhdl +161 -0
  107. data/vendor/pygments-main/tests/old_run.py +1 -1
  108. data/vendor/pygments-main/tests/run.py +1 -1
  109. data/vendor/pygments-main/tests/test_basic_api.py +4 -3
  110. data/vendor/pygments-main/tests/test_clexer.py +1 -1
  111. data/vendor/pygments-main/tests/test_cmdline.py +1 -1
  112. data/vendor/pygments-main/tests/test_examplefiles.py +4 -3
  113. data/vendor/pygments-main/tests/test_html_formatter.py +33 -1
  114. data/vendor/pygments-main/tests/test_latex_formatter.py +1 -1
  115. data/vendor/pygments-main/tests/test_perllexer.py +137 -0
  116. data/vendor/pygments-main/tests/test_regexlexer.py +1 -1
  117. data/vendor/pygments-main/tests/test_token.py +1 -1
  118. data/vendor/pygments-main/tests/test_using_api.py +1 -1
  119. data/vendor/pygments-main/tests/test_util.py +35 -5
  120. metadata +30 -4
@@ -5,7 +5,7 @@
5
5
 
6
6
  Lexers for various template engines' markup.
7
7
 
8
- :copyright: Copyright 2006-2011 by the Pygments team, see AUTHORS.
8
+ :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
9
9
  :license: BSD, see LICENSE for details.
10
10
  """
11
11
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Lexers for non-source code file types.
7
7
 
8
- :copyright: Copyright 2006-2011 by the Pygments team, see AUTHORS.
8
+ :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
9
9
  :license: BSD, see LICENSE for details.
10
10
  """
11
11
 
@@ -16,7 +16,7 @@ from pygments.lexer import Lexer, LexerContext, RegexLexer, ExtendedRegexLexer,
16
16
  bygroups, include, using, this, do_insertions
17
17
  from pygments.token import Punctuation, Text, Comment, Keyword, Name, String, \
18
18
  Generic, Operator, Number, Whitespace, Literal
19
- from pygments.util import get_bool_opt
19
+ from pygments.util import get_bool_opt, ClassNotFound
20
20
  from pygments.lexers.other import BashLexer
21
21
 
22
22
  __all__ = ['IniLexer', 'PropertiesLexer', 'SourcesListLexer', 'BaseMakefileLexer',
@@ -24,7 +24,8 @@ __all__ = ['IniLexer', 'PropertiesLexer', 'SourcesListLexer', 'BaseMakefileLexer
24
24
  'GroffLexer', 'ApacheConfLexer', 'BBCodeLexer', 'MoinWikiLexer',
25
25
  'RstLexer', 'VimLexer', 'GettextLexer', 'SquidConfLexer',
26
26
  'DebianControlLexer', 'DarcsPatchLexer', 'YamlLexer',
27
- 'LighttpdConfLexer', 'NginxConfLexer', 'CMakeLexer']
27
+ 'LighttpdConfLexer', 'NginxConfLexer', 'CMakeLexer', 'HttpLexer',
28
+ 'PyPyLogLexer']
28
29
 
29
30
 
30
31
  class IniLexer(RegexLexer):
@@ -613,7 +614,6 @@ class RstLexer(RegexLexer):
613
614
 
614
615
  def _handle_sourcecode(self, match):
615
616
  from pygments.lexers import get_lexer_by_name
616
- from pygments.util import ClassNotFound
617
617
 
618
618
  # section header
619
619
  yield match.start(1), Punctuation, match.group(1)
@@ -774,15 +774,16 @@ class VimLexer(RegexLexer):
774
774
 
775
775
  tokens = {
776
776
  'root': [
777
- # Who decided that doublequote was a good comment character??
778
777
  (r'^\s*".*', Comment),
779
- (r'(?<=\s)"[^\-:.%#=*].*', Comment),
780
778
 
781
779
  (r'[ \t]+', Text),
782
780
  # TODO: regexes can have other delims
783
781
  (r'/(\\\\|\\/|[^\n/])*/', String.Regex),
784
782
  (r'"(\\\\|\\"|[^\n"])*"', String.Double),
785
783
  (r"'(\\\\|\\'|[^\n'])*'", String.Single),
784
+
785
+ # Who decided that doublequote was a good comment character??
786
+ (r'(?<=\s)"[^\-:.%#=*].*', Comment),
786
787
  (r'-?\d+', Number),
787
788
  (r'#[0-9a-f]{6}', Number.Hex),
788
789
  (r'^:', Punctuation),
@@ -883,99 +884,99 @@ class SquidConfLexer(RegexLexer):
883
884
  mimetypes = ['text/x-squidconf']
884
885
  flags = re.IGNORECASE
885
886
 
886
- keywords = [ "access_log", "acl", "always_direct", "announce_host",
887
- "announce_period", "announce_port", "announce_to",
888
- "anonymize_headers", "append_domain", "as_whois_server",
889
- "auth_param_basic", "authenticate_children",
890
- "authenticate_program", "authenticate_ttl", "broken_posts",
891
- "buffered_logs", "cache_access_log", "cache_announce",
892
- "cache_dir", "cache_dns_program", "cache_effective_group",
893
- "cache_effective_user", "cache_host", "cache_host_acl",
894
- "cache_host_domain", "cache_log", "cache_mem",
895
- "cache_mem_high", "cache_mem_low", "cache_mgr",
896
- "cachemgr_passwd", "cache_peer", "cache_peer_access",
897
- "cahce_replacement_policy", "cache_stoplist",
898
- "cache_stoplist_pattern", "cache_store_log", "cache_swap",
899
- "cache_swap_high", "cache_swap_log", "cache_swap_low",
900
- "client_db", "client_lifetime", "client_netmask",
901
- "connect_timeout", "coredump_dir", "dead_peer_timeout",
902
- "debug_options", "delay_access", "delay_class",
903
- "delay_initial_bucket_level", "delay_parameters",
904
- "delay_pools", "deny_info", "dns_children", "dns_defnames",
905
- "dns_nameservers", "dns_testnames", "emulate_httpd_log",
906
- "err_html_text", "fake_user_agent", "firewall_ip",
907
- "forwarded_for", "forward_snmpd_port", "fqdncache_size",
908
- "ftpget_options", "ftpget_program", "ftp_list_width",
909
- "ftp_passive", "ftp_user", "half_closed_clients",
910
- "header_access", "header_replace", "hierarchy_stoplist",
911
- "high_response_time_warning", "high_page_fault_warning", "hosts_file",
912
- "htcp_port", "http_access", "http_anonymizer", "httpd_accel",
913
- "httpd_accel_host", "httpd_accel_port",
914
- "httpd_accel_uses_host_header", "httpd_accel_with_proxy",
915
- "http_port", "http_reply_access", "icp_access",
916
- "icp_hit_stale", "icp_port", "icp_query_timeout",
917
- "ident_lookup", "ident_lookup_access", "ident_timeout",
918
- "incoming_http_average", "incoming_icp_average",
919
- "inside_firewall", "ipcache_high", "ipcache_low",
920
- "ipcache_size", "local_domain", "local_ip", "logfile_rotate",
921
- "log_fqdn", "log_icp_queries", "log_mime_hdrs",
922
- "maximum_object_size", "maximum_single_addr_tries",
923
- "mcast_groups", "mcast_icp_query_timeout", "mcast_miss_addr",
924
- "mcast_miss_encode_key", "mcast_miss_port", "memory_pools",
925
- "memory_pools_limit", "memory_replacement_policy",
926
- "mime_table", "min_http_poll_cnt", "min_icp_poll_cnt",
927
- "minimum_direct_hops", "minimum_object_size",
928
- "minimum_retry_timeout", "miss_access", "negative_dns_ttl",
929
- "negative_ttl", "neighbor_timeout", "neighbor_type_domain",
930
- "netdb_high", "netdb_low", "netdb_ping_period",
931
- "netdb_ping_rate", "never_direct", "no_cache",
932
- "passthrough_proxy", "pconn_timeout", "pid_filename",
933
- "pinger_program", "positive_dns_ttl", "prefer_direct",
934
- "proxy_auth", "proxy_auth_realm", "query_icmp", "quick_abort",
935
- "quick_abort", "quick_abort_max", "quick_abort_min",
936
- "quick_abort_pct", "range_offset_limit", "read_timeout",
937
- "redirect_children", "redirect_program",
938
- "redirect_rewrites_host_header", "reference_age",
939
- "reference_age", "refresh_pattern", "reload_into_ims",
940
- "request_body_max_size", "request_size", "request_timeout",
941
- "shutdown_lifetime", "single_parent_bypass",
942
- "siteselect_timeout", "snmp_access", "snmp_incoming_address",
943
- "snmp_port", "source_ping", "ssl_proxy",
944
- "store_avg_object_size", "store_objects_per_bucket",
945
- "strip_query_terms", "swap_level1_dirs", "swap_level2_dirs",
946
- "tcp_incoming_address", "tcp_outgoing_address",
947
- "tcp_recv_bufsize", "test_reachability", "udp_hit_obj",
948
- "udp_hit_obj_size", "udp_incoming_address",
949
- "udp_outgoing_address", "unique_hostname", "unlinkd_program",
950
- "uri_whitespace", "useragent_log", "visible_hostname",
951
- "wais_relay", "wais_relay_host", "wais_relay_port",
952
- ]
953
-
954
- opts = [ "proxy-only", "weight", "ttl", "no-query", "default",
955
- "round-robin", "multicast-responder", "on", "off", "all",
956
- "deny", "allow", "via", "parent", "no-digest", "heap", "lru",
957
- "realm", "children", "credentialsttl", "none", "disable",
958
- "offline_toggle", "diskd", "q1", "q2",
959
- ]
960
-
961
- actions = [ "shutdown", "info", "parameter", "server_list",
962
- "client_list", r'squid\.conf',
963
- ]
964
-
965
- actions_stats = [ "objects", "vm_objects", "utilization",
966
- "ipcache", "fqdncache", "dns", "redirector", "io",
967
- "reply_headers", "filedescriptors", "netdb",
968
- ]
969
-
970
- actions_log = [ "status", "enable", "disable", "clear"]
971
-
972
- acls = [ "url_regex", "urlpath_regex", "referer_regex", "port",
973
- "proto", "req_mime_type", "rep_mime_type", "method",
974
- "browser", "user", "src", "dst", "time", "dstdomain", "ident",
975
- "snmp_community",
976
- ]
977
-
978
- ip_re = r'(?:(?:(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|0x0*[0-9a-f]{1,2}|0+[1-3]?[0-7]{0,2})(?:\.(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|0x0*[0-9a-f]{1,2}|0+[1-3]?[0-7]{0,2})){3})|(?!.*::.*::)(?:(?!:)|:(?=:))(?:[0-9a-f]{0,4}(?:(?<=::)|(?<!::):)){6}(?:[0-9a-f]{0,4}(?:(?<=::)|(?<!::):)[0-9a-f]{0,4}(?:(?<=::)|(?<!:)|(?<=:)(?<!::):)|(?:25[0-4]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-4]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))'
887
+ keywords = [
888
+ "access_log", "acl", "always_direct", "announce_host",
889
+ "announce_period", "announce_port", "announce_to", "anonymize_headers",
890
+ "append_domain", "as_whois_server", "auth_param_basic",
891
+ "authenticate_children", "authenticate_program", "authenticate_ttl",
892
+ "broken_posts", "buffered_logs", "cache_access_log", "cache_announce",
893
+ "cache_dir", "cache_dns_program", "cache_effective_group",
894
+ "cache_effective_user", "cache_host", "cache_host_acl",
895
+ "cache_host_domain", "cache_log", "cache_mem", "cache_mem_high",
896
+ "cache_mem_low", "cache_mgr", "cachemgr_passwd", "cache_peer",
897
+ "cache_peer_access", "cahce_replacement_policy", "cache_stoplist",
898
+ "cache_stoplist_pattern", "cache_store_log", "cache_swap",
899
+ "cache_swap_high", "cache_swap_log", "cache_swap_low", "client_db",
900
+ "client_lifetime", "client_netmask", "connect_timeout", "coredump_dir",
901
+ "dead_peer_timeout", "debug_options", "delay_access", "delay_class",
902
+ "delay_initial_bucket_level", "delay_parameters", "delay_pools",
903
+ "deny_info", "dns_children", "dns_defnames", "dns_nameservers",
904
+ "dns_testnames", "emulate_httpd_log", "err_html_text",
905
+ "fake_user_agent", "firewall_ip", "forwarded_for", "forward_snmpd_port",
906
+ "fqdncache_size", "ftpget_options", "ftpget_program", "ftp_list_width",
907
+ "ftp_passive", "ftp_user", "half_closed_clients", "header_access",
908
+ "header_replace", "hierarchy_stoplist", "high_response_time_warning",
909
+ "high_page_fault_warning", "hosts_file", "htcp_port", "http_access",
910
+ "http_anonymizer", "httpd_accel", "httpd_accel_host",
911
+ "httpd_accel_port", "httpd_accel_uses_host_header",
912
+ "httpd_accel_with_proxy", "http_port", "http_reply_access",
913
+ "icp_access", "icp_hit_stale", "icp_port", "icp_query_timeout",
914
+ "ident_lookup", "ident_lookup_access", "ident_timeout",
915
+ "incoming_http_average", "incoming_icp_average", "inside_firewall",
916
+ "ipcache_high", "ipcache_low", "ipcache_size", "local_domain",
917
+ "local_ip", "logfile_rotate", "log_fqdn", "log_icp_queries",
918
+ "log_mime_hdrs", "maximum_object_size", "maximum_single_addr_tries",
919
+ "mcast_groups", "mcast_icp_query_timeout", "mcast_miss_addr",
920
+ "mcast_miss_encode_key", "mcast_miss_port", "memory_pools",
921
+ "memory_pools_limit", "memory_replacement_policy", "mime_table",
922
+ "min_http_poll_cnt", "min_icp_poll_cnt", "minimum_direct_hops",
923
+ "minimum_object_size", "minimum_retry_timeout", "miss_access",
924
+ "negative_dns_ttl", "negative_ttl", "neighbor_timeout",
925
+ "neighbor_type_domain", "netdb_high", "netdb_low", "netdb_ping_period",
926
+ "netdb_ping_rate", "never_direct", "no_cache", "passthrough_proxy",
927
+ "pconn_timeout", "pid_filename", "pinger_program", "positive_dns_ttl",
928
+ "prefer_direct", "proxy_auth", "proxy_auth_realm", "query_icmp",
929
+ "quick_abort", "quick_abort", "quick_abort_max", "quick_abort_min",
930
+ "quick_abort_pct", "range_offset_limit", "read_timeout",
931
+ "redirect_children", "redirect_program",
932
+ "redirect_rewrites_host_header", "reference_age", "reference_age",
933
+ "refresh_pattern", "reload_into_ims", "request_body_max_size",
934
+ "request_size", "request_timeout", "shutdown_lifetime",
935
+ "single_parent_bypass", "siteselect_timeout", "snmp_access",
936
+ "snmp_incoming_address", "snmp_port", "source_ping", "ssl_proxy",
937
+ "store_avg_object_size", "store_objects_per_bucket",
938
+ "strip_query_terms", "swap_level1_dirs", "swap_level2_dirs",
939
+ "tcp_incoming_address", "tcp_outgoing_address", "tcp_recv_bufsize",
940
+ "test_reachability", "udp_hit_obj", "udp_hit_obj_size",
941
+ "udp_incoming_address", "udp_outgoing_address", "unique_hostname",
942
+ "unlinkd_program", "uri_whitespace", "useragent_log",
943
+ "visible_hostname", "wais_relay", "wais_relay_host", "wais_relay_port",
944
+ ]
945
+
946
+ opts = [
947
+ "proxy-only", "weight", "ttl", "no-query", "default", "round-robin",
948
+ "multicast-responder", "on", "off", "all", "deny", "allow", "via",
949
+ "parent", "no-digest", "heap", "lru", "realm", "children", "q1", "q2",
950
+ "credentialsttl", "none", "disable", "offline_toggle", "diskd",
951
+ ]
952
+
953
+ actions = [
954
+ "shutdown", "info", "parameter", "server_list", "client_list",
955
+ r'squid\.conf',
956
+ ]
957
+
958
+ actions_stats = [
959
+ "objects", "vm_objects", "utilization", "ipcache", "fqdncache", "dns",
960
+ "redirector", "io", "reply_headers", "filedescriptors", "netdb",
961
+ ]
962
+
963
+ actions_log = ["status", "enable", "disable", "clear"]
964
+
965
+ acls = [
966
+ "url_regex", "urlpath_regex", "referer_regex", "port", "proto",
967
+ "req_mime_type", "rep_mime_type", "method", "browser", "user", "src",
968
+ "dst", "time", "dstdomain", "ident", "snmp_community",
969
+ ]
970
+
971
+ ip_re = (
972
+ r'(?:(?:(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|0x0*[0-9a-f]{1,2}|'
973
+ r'0+[1-3]?[0-7]{0,2})(?:\.(?:[3-9]\d?|2(?:5[0-5]|[0-4]?\d)?|1\d{0,2}|'
974
+ r'0x0*[0-9a-f]{1,2}|0+[1-3]?[0-7]{0,2})){3})|(?!.*::.*::)(?:(?!:)|'
975
+ r':(?=:))(?:[0-9a-f]{0,4}(?:(?<=::)|(?<!::):)){6}(?:[0-9a-f]{0,4}'
976
+ r'(?:(?<=::)|(?<!::):)[0-9a-f]{0,4}(?:(?<=::)|(?<!:)|(?<=:)(?<!::):)|'
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|'
978
+ r'[1-9]?\d)){3}))'
979
+ )
979
980
 
980
981
  def makelistre(list):
981
982
  return r'\b(?:' + '|'.join(list) + r')\b'
@@ -1033,7 +1034,8 @@ class DebianControlLexer(RegexLexer):
1033
1034
  (r'.', Text),
1034
1035
  ],
1035
1036
  'description': [
1036
- (r'(.*)(Homepage)(: )([^\s]+)', bygroups(Text, String, Name, Name.Class)),
1037
+ (r'(.*)(Homepage)(: )([^\s]+)',
1038
+ bygroups(Text, String, Name, Name.Class)),
1037
1039
  (r':.*\n', Generic.Strong),
1038
1040
  (r' .*\n', Text),
1039
1041
  ('', Text, '#pop'),
@@ -1613,3 +1615,138 @@ class CMakeLexer(RegexLexer):
1613
1615
  ]
1614
1616
  }
1615
1617
 
1618
+
1619
+ class HttpLexer(RegexLexer):
1620
+ """
1621
+ Lexer for HTTP sessions.
1622
+
1623
+ *New in Pygments 1.5.*
1624
+ """
1625
+
1626
+ name = 'HTTP'
1627
+ aliases = ['http']
1628
+
1629
+ flags = re.DOTALL
1630
+
1631
+ def header_callback(self, match):
1632
+ if match.group(1).lower() == 'content-type':
1633
+ content_type = match.group(5).strip()
1634
+ if ';' in content_type:
1635
+ content_type = content_type[:content_type.find(';')].strip()
1636
+ self.content_type = content_type
1637
+ yield match.start(1), Name.Attribute, match.group(1)
1638
+ yield match.start(2), Text, match.group(2)
1639
+ yield match.start(3), Operator, match.group(3)
1640
+ yield match.start(4), Text, match.group(4)
1641
+ yield match.start(5), Literal, match.group(5)
1642
+ yield match.start(6), Text, match.group(6)
1643
+
1644
+ def content_callback(self, match):
1645
+ content_type = getattr(self, 'content_type', None)
1646
+ content = match.group()
1647
+ offset = match.start()
1648
+ if content_type:
1649
+ from pygments.lexers import get_lexer_for_mimetype
1650
+ try:
1651
+ lexer = get_lexer_for_mimetype(content_type)
1652
+ except ClassNotFound:
1653
+ pass
1654
+ else:
1655
+ for idx, token, value in lexer.get_tokens_unprocessed(content):
1656
+ yield offset + idx, token, value
1657
+ return
1658
+ yield offset, Text, content
1659
+
1660
+ tokens = {
1661
+ 'root': [
1662
+ (r'(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE)( +)([^ ]+)( +)'
1663
+ r'(HTTPS?)(/)(1\.[01])(\r?\n|$)',
1664
+ bygroups(Name.Function, Text, Name.Namespace, Text,
1665
+ Keyword.Reserved, Operator, Number, Text),
1666
+ 'headers'),
1667
+ (r'(HTTPS?)(/)(1\.[01])( +)(\d{3})( +)([^\r\n]+)(\r?\n|$)',
1668
+ bygroups(Keyword.Reserved, Operator, Number, Text, Number,
1669
+ Text, Name.Exception, Text),
1670
+ 'headers'),
1671
+ ],
1672
+ 'headers': [
1673
+ (r'([^\s:]+)( *)(:)( *)([^\r\n]+)(\r?\n|$)', header_callback),
1674
+ (r'\r?\n', Text, 'content')
1675
+ ],
1676
+ 'content': [
1677
+ (r'.+', content_callback)
1678
+ ]
1679
+ }
1680
+
1681
+
1682
+ class PyPyLogLexer(RegexLexer):
1683
+ """
1684
+ Lexer for PyPy log files.
1685
+
1686
+ *New in Pygments 1.5.*
1687
+ """
1688
+ name = "PyPy Log"
1689
+ aliases = ["pypylog", "pypy"]
1690
+ filenames = ["*.pypylog"]
1691
+ mimetypes = ['application/x-pypylog']
1692
+
1693
+ tokens = {
1694
+ "root": [
1695
+ (r"\[\w+\] {jit-log-.*?$", Keyword, "jit-log"),
1696
+ (r"\[\w+\] {jit-backend-counts$", Keyword, "jit-backend-counts"),
1697
+ include("extra-stuff"),
1698
+ ],
1699
+ "jit-log": [
1700
+ (r"\[\w+\] jit-log-.*?}$", Keyword, "#pop"),
1701
+
1702
+ (r"^\+\d+: ", Comment),
1703
+ (r"[ifp]\d+", Name),
1704
+ (r"ptr\d+", Name),
1705
+ (r"(\()([\w_]+(?:\.[\w_]+)?)(\))",
1706
+ bygroups(Punctuation, Name.Builtin, Punctuation)),
1707
+ (r"[\[\]=,()]", Punctuation),
1708
+ (r"(\d+\.\d+|inf|-inf)", Number.Float),
1709
+ (r"-?\d+", Number.Integer),
1710
+ (r"'.*'", String),
1711
+ (r"(None|descr|ConstClass|ConstPtr|TargetToken)", Name),
1712
+ (r"<.*?>", Name.Builtin),
1713
+ (r"(label|debug_merge_point|jump|finish)", Name.Class),
1714
+ (r"(int_add_ovf|int_add|int_sub_ovf|int_sub|int_mul_ovf|int_mul|"
1715
+ r"int_floordiv|int_mod|int_lshift|int_rshift|int_and|int_or|"
1716
+ r"int_xor|int_eq|int_ne|int_ge|int_gt|int_le|int_lt|int_is_zero|"
1717
+ r"int_is_true|"
1718
+ r"uint_floordiv|uint_ge|uint_lt|"
1719
+ r"float_add|float_sub|float_mul|float_truediv|"
1720
+ r"float_eq|float_ne|float_ge|float_gt|float_le|float_lt|float_abs|"
1721
+ r"ptr_eq|ptr_ne|instance_ptr_eq|instance_ptr_ne|"
1722
+ r"cast_int_to_float|cast_float_to_int|"
1723
+ r"force_token|quasiimmut_field|same_as|virtual_ref_finish|"
1724
+ r"virtual_ref|mark_opaque_ptr|"
1725
+ r"call_may_force|call_assembler|call_loopinvariant|"
1726
+ r"call_release_gil|call_pure|call|"
1727
+ r"new_with_vtable|new_array|newstr|newunicode|new|"
1728
+ r"arraylen_gc|"
1729
+ r"getarrayitem_gc_pure|getarrayitem_gc|setarrayitem_gc|"
1730
+ r"getarrayitem_raw|setarrayitem_raw|getfield_gc_pure|"
1731
+ r"getfield_gc|getinteriorfield_gc|"
1732
+ r"getinteriorfield_gc|setinteriorfield_gc|"
1733
+ r"getfield_raw|setfield_gc|setfield_raw|"
1734
+ r"strgetitem|strsetitem|strlen|copystrcontent|"
1735
+ r"unicodegetitem|unicodesetitem|unicodelen|"
1736
+ r"guard_true|guard_false|guard_value|guard_isnull|"
1737
+ r"guard_nonnull_class|guard_nonnull|guard_class|guard_no_overflow|"
1738
+ r"guard_not_forced|guard_no_exception|guard_not_invalidated)",
1739
+ Name.Builtin),
1740
+ include("extra-stuff"),
1741
+ ],
1742
+ "jit-backend-counts": [
1743
+ (r"\[\w+\] jit-backend-counts}$", Keyword, "#pop"),
1744
+ (r"[:]", Punctuation),
1745
+ (r"\d+", Number),
1746
+ include("extra-stuff"),
1747
+ ],
1748
+ "extra-stuff": [
1749
+ (r"[\n\s]+", Text),
1750
+ (r"#.*?$", Comment),
1751
+ ],
1752
+ }
@@ -5,7 +5,7 @@
5
5
 
6
6
  Lexers for web-related languages and markup.
7
7
 
8
- :copyright: Copyright 2006-2011 by the Pygments team, see AUTHORS.
8
+ :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
9
9
  :license: BSD, see LICENSE for details.
10
10
  """
11
11
 
@@ -22,11 +22,11 @@ from pygments.lexers.agile import RubyLexer
22
22
  from pygments.lexers.compiled import ScalaLexer
23
23
 
24
24
 
25
- __all__ = ['HtmlLexer', 'XmlLexer', 'JavascriptLexer', 'CssLexer',
25
+ __all__ = ['HtmlLexer', 'XmlLexer', 'JavascriptLexer', 'JSONLexer', 'CssLexer',
26
26
  'PhpLexer', 'ActionScriptLexer', 'XsltLexer', 'ActionScript3Lexer',
27
27
  'MxmlLexer', 'HaxeLexer', 'HamlLexer', 'SassLexer', 'ScssLexer',
28
28
  'ObjectiveJLexer', 'CoffeeScriptLexer', 'DuelLexer', 'ScamlLexer',
29
- 'JadeLexer', 'XQueryLexer', 'DtdLexer']
29
+ 'JadeLexer', 'XQueryLexer', 'DtdLexer', 'DartLexer']
30
30
 
31
31
 
32
32
  class JavascriptLexer(RegexLexer):
@@ -36,9 +36,9 @@ class JavascriptLexer(RegexLexer):
36
36
 
37
37
  name = 'JavaScript'
38
38
  aliases = ['js', 'javascript']
39
- filenames = ['*.js', '*.json']
39
+ filenames = ['*.js', ]
40
40
  mimetypes = ['application/javascript', 'application/x-javascript',
41
- 'text/x-javascript', 'text/javascript', 'application/json']
41
+ 'text/x-javascript', 'text/javascript', ]
42
42
 
43
43
  flags = re.DOTALL
44
44
  tokens = {
@@ -89,6 +89,74 @@ class JavascriptLexer(RegexLexer):
89
89
  }
90
90
 
91
91
 
92
+ class JSONLexer(RegexLexer):
93
+ """
94
+ For JSON data structures.
95
+
96
+ *New in Pygments 1.5.*
97
+ """
98
+
99
+ name = 'JSON'
100
+ aliases = ['json']
101
+ filenames = ['*.json']
102
+ mimetypes = [ 'application/json', ]
103
+
104
+ flags = re.DOTALL
105
+ tokens = {
106
+ 'whitespace': [
107
+ (r'\s+', Text),
108
+ ],
109
+
110
+ # represents a simple terminal value
111
+ 'simplevalue':[
112
+ (r'(true|false|null)\b', Keyword.Constant),
113
+ (r'-?[0-9]+', Number.Integer),
114
+ (r'"(\\\\|\\"|[^"])*"', String.Double),
115
+ ],
116
+
117
+
118
+ # the right hand side of an object, after the attribute name
119
+ 'objectattribute': [
120
+ include('value'),
121
+ (r':', Punctuation),
122
+ # comma terminates the attribute but expects more
123
+ (r',', Punctuation, '#pop'),
124
+ # a closing bracket terminates the entire object, so pop twice
125
+ (r'}', Punctuation, ('#pop', '#pop')),
126
+ ],
127
+
128
+ # a json object - { attr, attr, ... }
129
+ 'objectvalue': [
130
+ include('whitespace'),
131
+ (r'"(\\\\|\\"|[^"])*"', Name.Tag, 'objectattribute'),
132
+ (r'}', Punctuation, '#pop'),
133
+ ],
134
+
135
+ # json array - [ value, value, ... }
136
+ 'arrayvalue': [
137
+ include('whitespace'),
138
+ include('value'),
139
+ (r',', Punctuation),
140
+ (r']', Punctuation, '#pop'),
141
+ ],
142
+
143
+ # a json value - either a simple value or a complex value (object or array)
144
+ 'value': [
145
+ include('whitespace'),
146
+ include('simplevalue'),
147
+ (r'{', Punctuation, 'objectvalue'),
148
+ (r'\[', Punctuation, 'arrayvalue'),
149
+ ],
150
+
151
+
152
+ # the root of a json document whould be a value
153
+ 'root': [
154
+ include('value'),
155
+ ],
156
+
157
+ }
158
+
159
+
92
160
  class ActionScriptLexer(RegexLexer):
93
161
  """
94
162
  For ActionScript source code.
@@ -388,7 +456,7 @@ class CssLexer(RegexLexer):
388
456
  (r'[\[\]();]+', Punctuation),
389
457
  (r'"(\\\\|\\"|[^"])*"', String.Double),
390
458
  (r"'(\\\\|\\'|[^'])*'", String.Single),
391
- (r'[a-zA-Z][a-zA-Z0-9]+', Name)
459
+ (r'[a-zA-Z_][a-zA-Z0-9_]+', Name)
392
460
  ]
393
461
  }
394
462
 
@@ -1728,12 +1796,13 @@ class CoffeeScriptLexer(RegexLexer):
1728
1796
  'slashstartsregex': [
1729
1797
  include('commentsandwhitespace'),
1730
1798
  (r'///', String.Regex, ('#pop', 'multilineregex')),
1731
- (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
1799
+ (r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
1732
1800
  r'([gim]+\b|\B)', String.Regex, '#pop'),
1733
1801
  (r'', Text, '#pop'),
1734
1802
  ],
1735
1803
  'root': [
1736
- (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
1804
+ # this next expr leads to infinite loops root -> slashstartsregex
1805
+ #(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
1737
1806
  include('commentsandwhitespace'),
1738
1807
  (r'\+\+|--|~|&&|\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|\?|:|=|'
1739
1808
  r'\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*`%&\|\^/])=?',
@@ -1766,8 +1835,9 @@ class CoffeeScriptLexer(RegexLexer):
1766
1835
  ("'", String, 'sqs'),
1767
1836
  ],
1768
1837
  'strings': [
1769
- (r'[^#\\\'"]+', String) # note that all coffee script strings are multi-line.
1770
- # hashmarks, quotes and backslashes must be parsed one at a time
1838
+ (r'[^#\\\'"]+', String),
1839
+ # note that all coffee script strings are multi-line.
1840
+ # hashmarks, quotes and backslashes must be parsed one at a time
1771
1841
  ],
1772
1842
  'interpoling_string' : [
1773
1843
  (r'}', String.Interpol, "#pop"),
@@ -2707,3 +2777,69 @@ class XQueryLexer(ExtendedRegexLexer):
2707
2777
  ]
2708
2778
  }
2709
2779
 
2780
+
2781
+ class DartLexer(RegexLexer):
2782
+ """
2783
+ For `Dart <http://dartlang.org/>`_ source code.
2784
+
2785
+ *New in Pygments 1.5.*
2786
+ """
2787
+
2788
+ name = 'Dart'
2789
+ aliases = ['dart']
2790
+ filenames = ['*.dart']
2791
+ mimetypes = ['text/x-dart']
2792
+
2793
+ flags = re.MULTILINE | re.DOTALL
2794
+
2795
+ tokens = {
2796
+ 'root': [
2797
+ (r'#!(.*?)$', Comment.Preproc),
2798
+ (r'(#)(import|library|source)', bygroups(Text, Keyword)),
2799
+ (r'[^\S\n]+', Text),
2800
+ (r'//.*?\n', Comment.Single),
2801
+ (r'/\*.*?\*/', Comment.Multiline),
2802
+ (r'(class|interface)(\s+)',
2803
+ bygroups(Keyword.Declaration, Text), 'class'),
2804
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
2805
+ r'if|in|is|new|return|super|switch|this|throw|try|while)\b',
2806
+ Keyword),
2807
+ (r'(abstract|const|extends|factory|final|get|implements|'
2808
+ r'native|operator|set|static|typedef|var)\b', Keyword.Declaration),
2809
+ (r'(bool|double|Dynamic|int|num|Object|String|void)', Keyword.Type),
2810
+ (r'(false|null|true)', Keyword.Constant),
2811
+ (r'@"(\\\\|\\"|[^"])*"', String.Double), # raw string
2812
+ (r"@'(\\\\|\\'|[^'])*'", String.Single), # raw string
2813
+ (r'"', String.Double, 'string_double'),
2814
+ (r"'", String.Single, 'string_single'),
2815
+ (r'[a-zA-Z_$][a-zA-Z0-9_]*:', Name.Label),
2816
+ (r'[a-zA-Z_$][a-zA-Z0-9_]*', Name),
2817
+ (r'[~!%^&*+=|?:<>/-]', Operator),
2818
+ (r'[(){}\[\],.;]', Punctuation),
2819
+ (r'0[xX][0-9a-fA-F]+', Number.Hex),
2820
+ # DIGIT+ (‘.’ DIGIT*)? EXPONENT?
2821
+ (r'\d+(\.\d*)?([eE][+-]?\d+)?', Number),
2822
+ (r'\.\d+([eE][+-]?\d+)?', Number), # ‘.’ DIGIT+ EXPONENT?
2823
+ (r'\n', Text)
2824
+ # pseudo-keyword negate intentionally left out
2825
+ ],
2826
+ 'class': [
2827
+ (r'[a-zA-Z_$][a-zA-Z0-9_]*', Name.Class, '#pop')
2828
+ ],
2829
+ 'string_double': [
2830
+ (r'"', String.Double, '#pop'),
2831
+ (r'[^"$]+', String.Double),
2832
+ (r'(\$)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(String.Interpol, Name)),
2833
+ (r'(\$\{)(.*?)(\})',
2834
+ bygroups(String.Interpol, using(this), String.Interpol)),
2835
+ (r'\$+', String.Double)
2836
+ ],
2837
+ 'string_single': [
2838
+ (r"'", String.Single, '#pop'),
2839
+ (r"[^'$]+", String.Single),
2840
+ (r'(\$)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(String.Interpol, Name)),
2841
+ (r'(\$\{)(.*?)(\})',
2842
+ bygroups(String.Interpol, using(this), String.Interpol)),
2843
+ (r'\$+', String.Single)
2844
+ ]
2845
+ }