pygments.rb 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +40 -0
- data/README.md +3 -0
- data/lexers +0 -0
- data/lib/pygments/popen.rb +3 -2
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -1
- data/vendor/pygments-main/AUTHORS +20 -1
- data/vendor/pygments-main/CHANGES +55 -3
- data/vendor/pygments-main/LICENSE +1 -1
- data/vendor/pygments-main/MANIFEST.in +1 -1
- data/vendor/pygments-main/Makefile +5 -8
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/doc/Makefile +153 -0
- data/vendor/pygments-main/doc/_static/favicon.ico +0 -0
- data/vendor/pygments-main/doc/_static/logo_new.png +0 -0
- data/vendor/pygments-main/doc/_static/logo_only.png +0 -0
- data/vendor/pygments-main/doc/_templates/docssidebar.html +3 -0
- data/vendor/pygments-main/doc/_templates/indexsidebar.html +25 -0
- data/vendor/pygments-main/doc/_themes/pygments14/layout.html +98 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/bodybg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/docbg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/listitem.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/logo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pocoo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +401 -0
- data/vendor/pygments-main/doc/_themes/pygments14/theme.conf +15 -0
- data/vendor/pygments-main/doc/conf.py +249 -0
- data/vendor/pygments-main/doc/docs/api.rst +316 -0
- data/vendor/pygments-main/doc/docs/authors.rst +4 -0
- data/vendor/pygments-main/doc/docs/changelog.rst +1 -0
- data/vendor/pygments-main/{docs/src/cmdline.txt → doc/docs/cmdline.rst} +9 -11
- data/vendor/pygments-main/{docs/src/filterdevelopment.txt → doc/docs/filterdevelopment.rst} +1 -1
- data/vendor/pygments-main/{docs/src/filters.txt → doc/docs/filters.rst} +4 -5
- data/vendor/pygments-main/{docs/src/formatterdevelopment.txt → doc/docs/formatterdevelopment.rst} +1 -1
- data/vendor/pygments-main/{docs/src/formatters.txt → doc/docs/formatters.rst} +6 -6
- data/vendor/pygments-main/doc/docs/index.rst +66 -0
- data/vendor/pygments-main/{docs/src/integrate.txt → doc/docs/integrate.rst} +3 -7
- data/vendor/pygments-main/{docs/src/java.txt → doc/docs/java.rst} +0 -0
- data/vendor/pygments-main/{docs/src/lexerdevelopment.txt → doc/docs/lexerdevelopment.rst} +13 -14
- data/vendor/pygments-main/{docs/src/lexers.txt → doc/docs/lexers.rst} +7 -5
- data/vendor/pygments-main/{docs/src/moinmoin.txt → doc/docs/moinmoin.rst} +0 -0
- data/vendor/pygments-main/{docs/src/plugins.txt → doc/docs/plugins.rst} +0 -0
- data/vendor/pygments-main/{docs/src/quickstart.txt → doc/docs/quickstart.rst} +22 -19
- data/vendor/pygments-main/{docs/src/rstdirective.txt → doc/docs/rstdirective.rst} +0 -0
- data/vendor/pygments-main/{docs/src/styles.txt → doc/docs/styles.rst} +2 -2
- data/vendor/pygments-main/{docs/src/tokens.txt → doc/docs/tokens.rst} +10 -7
- data/vendor/pygments-main/{docs/src/unicode.txt → doc/docs/unicode.rst} +8 -7
- data/vendor/pygments-main/doc/download.rst +41 -0
- data/vendor/pygments-main/doc/faq.rst +143 -0
- data/vendor/pygments-main/doc/index.rst +53 -0
- data/vendor/pygments-main/doc/languages.rst +151 -0
- data/vendor/pygments-main/doc/make.bat +190 -0
- data/vendor/pygments-main/{docs → doc}/pygmentize.1 +0 -0
- data/vendor/pygments-main/external/autopygmentize +65 -48
- data/vendor/pygments-main/external/markdown-processor.py +15 -15
- data/vendor/pygments-main/external/moin-parser.py +1 -1
- data/vendor/pygments-main/external/rst-directive.py +2 -3
- data/vendor/pygments-main/ez_setup.py +340 -234
- data/vendor/pygments-main/pygments/__init__.py +4 -4
- data/vendor/pygments-main/pygments/cmdline.py +81 -68
- data/vendor/pygments-main/pygments/console.py +1 -1
- data/vendor/pygments-main/pygments/filter.py +1 -1
- data/vendor/pygments-main/pygments/filters/__init__.py +11 -9
- data/vendor/pygments-main/pygments/formatter.py +3 -3
- data/vendor/pygments-main/pygments/formatters/__init__.py +5 -3
- data/vendor/pygments-main/pygments/formatters/_mapping.py +16 -5
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +44 -26
- data/vendor/pygments-main/pygments/formatters/img.py +21 -14
- data/vendor/pygments-main/pygments/formatters/latex.py +104 -12
- data/vendor/pygments-main/pygments/formatters/other.py +53 -6
- data/vendor/pygments-main/pygments/formatters/rtf.py +30 -16
- data/vendor/pygments-main/pygments/formatters/svg.py +2 -2
- data/vendor/pygments-main/pygments/formatters/terminal.py +41 -1
- data/vendor/pygments-main/pygments/formatters/terminal256.py +2 -2
- data/vendor/pygments-main/pygments/lexer.py +59 -39
- data/vendor/pygments-main/pygments/lexers/__init__.py +38 -15
- data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +15 -15
- data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +73 -0
- data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +11 -1
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +14 -8
- data/vendor/pygments-main/pygments/lexers/_mapping.py +81 -30
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +1067 -95
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +7 -7
- data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +5 -4
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +12 -7
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +112 -18
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/agile.py +644 -382
- data/vendor/pygments-main/pygments/lexers/asm.py +66 -29
- data/vendor/pygments-main/pygments/lexers/compiled.py +1643 -174
- data/vendor/pygments-main/pygments/lexers/dalvik.py +27 -6
- data/vendor/pygments-main/pygments/lexers/dotnet.py +45 -33
- data/vendor/pygments-main/pygments/lexers/foxpro.py +3 -3
- data/vendor/pygments-main/pygments/lexers/functional.py +1510 -570
- data/vendor/pygments-main/pygments/lexers/graph.py +81 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +29 -30
- data/vendor/pygments-main/pygments/lexers/inferno.py +96 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +622 -207
- data/vendor/pygments-main/pygments/lexers/math.py +438 -70
- data/vendor/pygments-main/pygments/lexers/other.py +885 -171
- data/vendor/pygments-main/pygments/lexers/parsers.py +24 -24
- data/vendor/pygments-main/pygments/lexers/qbasic.py +157 -0
- data/vendor/pygments-main/pygments/lexers/rdf.py +99 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +28 -25
- data/vendor/pygments-main/pygments/lexers/special.py +7 -8
- data/vendor/pygments-main/pygments/lexers/sql.py +56 -23
- data/vendor/pygments-main/pygments/lexers/templates.py +377 -59
- data/vendor/pygments-main/pygments/lexers/text.py +208 -46
- data/vendor/pygments-main/pygments/lexers/web.py +729 -264
- data/vendor/pygments-main/pygments/modeline.py +1 -1
- data/vendor/pygments-main/pygments/plugin.py +1 -1
- data/vendor/pygments-main/pygments/scanner.py +1 -1
- data/vendor/pygments-main/pygments/sphinxext.py +153 -0
- data/vendor/pygments-main/pygments/style.py +3 -2
- data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
- data/vendor/pygments-main/pygments/styles/borland.py +1 -1
- data/vendor/pygments-main/pygments/styles/bw.py +1 -1
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
- data/vendor/pygments-main/pygments/styles/default.py +1 -1
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/igor.py +29 -0
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +4 -4
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
- data/vendor/pygments-main/pygments/styles/native.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +125 -0
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +125 -0
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
- data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
- data/vendor/pygments-main/pygments/styles/tango.py +1 -1
- data/vendor/pygments-main/pygments/styles/trac.py +1 -1
- data/vendor/pygments-main/pygments/styles/vim.py +1 -1
- data/vendor/pygments-main/pygments/styles/vs.py +1 -1
- data/vendor/pygments-main/pygments/styles/xcode.py +51 -0
- data/vendor/pygments-main/pygments/token.py +4 -1
- data/vendor/pygments-main/pygments/unistring.py +6 -5
- data/vendor/pygments-main/pygments/util.py +35 -21
- data/vendor/pygments-main/scripts/check_sources.py +28 -44
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +5 -4
- data/vendor/pygments-main/scripts/find_codetags.py +27 -19
- data/vendor/pygments-main/scripts/find_error.py +16 -13
- data/vendor/pygments-main/scripts/get_vimkw.py +3 -3
- data/vendor/pygments-main/scripts/vim2pygments.py +9 -7
- data/vendor/pygments-main/setup.py +19 -19
- data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +118 -0
- data/vendor/pygments-main/tests/examplefiles/Error.pmod +38 -0
- data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +360 -0
- data/vendor/pygments-main/tests/examplefiles/{ANTLRv3.g → antlr_ANTLRv3.g} +0 -0
- data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +5 -0
- data/vendor/pygments-main/tests/examplefiles/core.cljs +52 -0
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +13 -1
- data/vendor/pygments-main/tests/examplefiles/demo.hbs +12 -0
- data/vendor/pygments-main/tests/examplefiles/ember.handlebars +33 -0
- data/vendor/pygments-main/tests/examplefiles/example.als +217 -0
- data/vendor/pygments-main/tests/examplefiles/example.c +1 -1
- data/vendor/pygments-main/tests/examplefiles/example.chai +6 -0
- data/vendor/pygments-main/tests/examplefiles/example.coffee +27 -0
- data/vendor/pygments-main/tests/examplefiles/example.e +124 -0
- data/vendor/pygments-main/tests/examplefiles/example.f90 +8 -0
- data/vendor/pygments-main/tests/examplefiles/example.feature +16 -0
- data/vendor/pygments-main/tests/examplefiles/example.gd +23 -0
- data/vendor/pygments-main/tests/examplefiles/example.gi +64 -0
- data/vendor/pygments-main/tests/examplefiles/example.groovy +2 -0
- data/vendor/pygments-main/tests/examplefiles/example.hs +27 -0
- data/vendor/pygments-main/tests/examplefiles/example.hx +44 -1
- data/vendor/pygments-main/tests/examplefiles/example.i6t +32 -0
- data/vendor/pygments-main/tests/examplefiles/example.i7x +45 -0
- data/vendor/pygments-main/tests/examplefiles/example.inf +374 -0
- data/vendor/pygments-main/tests/examplefiles/example.j +564 -0
- data/vendor/pygments-main/tests/examplefiles/example.java +16 -0
- data/vendor/pygments-main/tests/examplefiles/example.kal +75 -0
- data/vendor/pygments-main/tests/examplefiles/example.liquid +42 -0
- data/vendor/pygments-main/tests/examplefiles/example.ma +8 -0
- data/vendor/pygments-main/tests/examplefiles/example.mq4 +187 -0
- data/vendor/pygments-main/tests/examplefiles/example.mqh +123 -0
- data/vendor/pygments-main/tests/examplefiles/example.ni +57 -0
- data/vendor/pygments-main/tests/examplefiles/example.nix +80 -0
- data/vendor/pygments-main/tests/examplefiles/example.pp +8 -0
- data/vendor/pygments-main/tests/examplefiles/example.red +257 -0
- data/vendor/pygments-main/tests/examplefiles/example.reds +150 -0
- data/vendor/pygments-main/tests/examplefiles/example.rkt +677 -29
- data/vendor/pygments-main/tests/examplefiles/example.sh +22 -0
- data/vendor/pygments-main/tests/examplefiles/example.slim +31 -0
- data/vendor/pygments-main/tests/examplefiles/example.sls +51 -0
- data/vendor/pygments-main/tests/examplefiles/example.stan +2 -0
- data/vendor/pygments-main/tests/examplefiles/example.todotxt +9 -0
- data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +241 -0
- data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +18 -0
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +192 -350
- data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +5 -0
- data/vendor/pygments-main/tests/examplefiles/hello.at +6 -0
- data/vendor/pygments-main/tests/examplefiles/hello.golo +5 -0
- data/vendor/pygments-main/tests/examplefiles/hello.lsl +12 -0
- data/vendor/pygments-main/tests/examplefiles/{File.hy → hybris_File.hy} +0 -0
- data/vendor/pygments-main/tests/examplefiles/{mg_sample.pro → idl_sample.pro} +0 -0
- data/vendor/pygments-main/tests/examplefiles/iex_example +23 -0
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +24 -24
- data/vendor/pygments-main/tests/examplefiles/language.hy +165 -0
- data/vendor/pygments-main/tests/examplefiles/limbo.b +456 -0
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +3 -1
- data/vendor/pygments-main/tests/examplefiles/main.cmake +2 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +163 -16
- data/vendor/pygments-main/tests/examplefiles/{example.p → openedge_example} +0 -0
- data/vendor/pygments-main/tests/examplefiles/pawn_example +25 -0
- data/vendor/pygments-main/tests/examplefiles/qbasic_example +2 -0
- data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +23 -0
- data/vendor/pygments-main/tests/examplefiles/{robotframework.txt → robotframework_test.txt} +0 -0
- data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +34 -0
- data/vendor/pygments-main/tests/examplefiles/scope.cirru +43 -0
- data/vendor/pygments-main/tests/examplefiles/sparql.rq +23 -0
- data/vendor/pygments-main/tests/examplefiles/test.R +37 -5
- data/vendor/pygments-main/tests/examplefiles/test.apl +26 -0
- data/vendor/pygments-main/tests/examplefiles/test.cyp +123 -0
- data/vendor/pygments-main/tests/examplefiles/test.idr +93 -0
- data/vendor/pygments-main/tests/examplefiles/test.mask +41 -0
- data/vendor/pygments-main/tests/examplefiles/test.pan +54 -0
- data/vendor/pygments-main/tests/examplefiles/test.php +3 -1
- data/vendor/pygments-main/tests/examplefiles/test.pig +148 -0
- data/vendor/pygments-main/tests/examplefiles/test.pwn +253 -0
- data/vendor/pygments-main/tests/examplefiles/test.r3 +27 -7
- data/vendor/pygments-main/tests/examplefiles/test.rsl +111 -0
- data/vendor/pygments-main/tests/examplefiles/test.swift +65 -0
- data/vendor/pygments-main/tests/examplefiles/test.zep +33 -0
- data/vendor/pygments-main/tests/examplefiles/unicode.go +10 -0
- data/vendor/pygments-main/tests/examplefiles/{test.bas → vbnet_test.bas} +0 -0
- data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +4 -0
- data/vendor/pygments-main/tests/examplefiles/vimrc +21 -0
- data/vendor/pygments-main/tests/run.py +14 -19
- data/vendor/pygments-main/tests/string_asserts.py +22 -0
- data/vendor/pygments-main/tests/test_basic_api.py +28 -14
- data/vendor/pygments-main/tests/test_cfm.py +46 -0
- data/vendor/pygments-main/tests/test_clexer.py +208 -3
- data/vendor/pygments-main/tests/test_cmdline.py +6 -5
- data/vendor/pygments-main/tests/test_examplefiles.py +30 -19
- data/vendor/pygments-main/tests/test_html_formatter.py +15 -13
- data/vendor/pygments-main/tests/test_latex_formatter.py +4 -2
- data/vendor/pygments-main/tests/test_lexers_other.py +11 -11
- data/vendor/pygments-main/tests/test_objectiveclexer.py +81 -0
- data/vendor/pygments-main/tests/test_perllexer.py +1 -1
- data/vendor/pygments-main/tests/test_qbasiclexer.py +43 -0
- data/vendor/pygments-main/tests/test_regexlexer.py +8 -1
- data/vendor/pygments-main/tests/test_rtf_formatter.py +109 -0
- data/vendor/pygments-main/tests/test_string_asserts.py +39 -0
- data/vendor/pygments-main/tests/test_token.py +3 -3
- data/vendor/pygments-main/tests/test_using_api.py +1 -1
- data/vendor/pygments-main/tests/test_util.py +1 -1
- metadata +138 -51
- data/vendor/pygments-main/docs/generate.py +0 -472
- data/vendor/pygments-main/docs/src/api.txt +0 -270
- data/vendor/pygments-main/docs/src/authors.txt +0 -5
- data/vendor/pygments-main/docs/src/changelog.txt +0 -5
- data/vendor/pygments-main/docs/src/index.txt +0 -69
- data/vendor/pygments-main/docs/src/installation.txt +0 -71
- data/vendor/pygments-main/external/rst-directive-old.py +0 -77
- data/vendor/pygments-main/scripts/reindent.py +0 -291
- data/vendor/pygments-main/tests/examplefiles/import.hs +0 -4
- data/vendor/pygments-main/tests/examplefiles/objc_example2.m +0 -24
- data/vendor/pygments-main/tests/old_run.py +0 -138
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class _PostUnico$deClassá
|
|
2
|
+
{void fo$o() {}
|
|
3
|
+
|
|
4
|
+
void PostUnicodeFunctioná() {
|
|
5
|
+
láb$el:
|
|
6
|
+
break láb$el;
|
|
7
|
+
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class áPreUnicode$Class
|
|
12
|
+
{
|
|
13
|
+
public int $foo;
|
|
14
|
+
public int á$foo;
|
|
15
|
+
_PostUnico$deClassá áPreUnicodeFunction() { return null; }
|
|
16
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env kal
|
|
2
|
+
|
|
3
|
+
# This demo executes GET requests in parallel and in series
|
|
4
|
+
# using `for` loops and `wait for` statements.
|
|
5
|
+
|
|
6
|
+
# Notice how the serial GET requests always return in order
|
|
7
|
+
# and take longer in total. Parallel requests come back in
|
|
8
|
+
# order of receipt.
|
|
9
|
+
|
|
10
|
+
http = require 'http'
|
|
11
|
+
|
|
12
|
+
urls = ['http://www.google.com'
|
|
13
|
+
'http://www.apple.com'
|
|
14
|
+
'http://www.microsoft.com'
|
|
15
|
+
'http://www.nodejs.org'
|
|
16
|
+
'http://www.yahoo.com']
|
|
17
|
+
|
|
18
|
+
# This function does a GET request for each URL in series
|
|
19
|
+
# It will wait for a response from each request before moving on
|
|
20
|
+
# to the next request. Notice the output will be in the same order as the
|
|
21
|
+
# urls variable every time regardless of response time.
|
|
22
|
+
# It is a task rather than a function because it is called asynchronously
|
|
23
|
+
# This allows us to use `return` to implicitly call back
|
|
24
|
+
task series_demo()
|
|
25
|
+
# The `series` keyword is optional here (for loops are serial by default)
|
|
26
|
+
total_time = 0
|
|
27
|
+
|
|
28
|
+
for series url in urls
|
|
29
|
+
timer = new Date
|
|
30
|
+
|
|
31
|
+
# we use the `safe` keyword because get is a "nonstandard" task
|
|
32
|
+
# that does not call back with an error argument
|
|
33
|
+
safe wait for response from http.get url
|
|
34
|
+
|
|
35
|
+
delay = new Date() - timer
|
|
36
|
+
total_time += delay
|
|
37
|
+
|
|
38
|
+
print "GET #{url} - #{response.statusCode} - #{response.connection.bytesRead} bytes - #{delay} ms"
|
|
39
|
+
|
|
40
|
+
# because we are in a task rather than a function, this actually exectutes a callback
|
|
41
|
+
return total_time
|
|
42
|
+
|
|
43
|
+
# This function does a GET request for each URL in parallel
|
|
44
|
+
# It will NOT wait for a response from each request before moving on
|
|
45
|
+
# to the next request. Notice the output will be determined by the order in which
|
|
46
|
+
# the requests complete!
|
|
47
|
+
task parallel_demo()
|
|
48
|
+
total_time = 0
|
|
49
|
+
|
|
50
|
+
# The `parallel` keyword is only meaningful here because the loop contains
|
|
51
|
+
# a `wait for` statement (meaning callbacks are used)
|
|
52
|
+
for parallel url in urls
|
|
53
|
+
timer = new Date
|
|
54
|
+
|
|
55
|
+
# we use the `safe` keyword because get is a "nonstandard" task
|
|
56
|
+
# that does not call back with an error argument
|
|
57
|
+
safe wait for response from http.get url
|
|
58
|
+
|
|
59
|
+
delay = new Date() - timer
|
|
60
|
+
total_time += delay
|
|
61
|
+
|
|
62
|
+
print "GET #{url} - #{response.statusCode} - #{response.connection.bytesRead} bytes - #{delay}ms"
|
|
63
|
+
|
|
64
|
+
# because we are in a task rather than a function, this actually exectutes a callback
|
|
65
|
+
return total_time
|
|
66
|
+
|
|
67
|
+
print 'Series Requests...'
|
|
68
|
+
wait for time1 from series_demo()
|
|
69
|
+
print "Total duration #{time1}ms"
|
|
70
|
+
|
|
71
|
+
print ''
|
|
72
|
+
|
|
73
|
+
print 'Parallel Requests...'
|
|
74
|
+
wait for time2 from parallel_demo()
|
|
75
|
+
print "Total duration #{time2}ms"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# This is an example file. Process it with `./pygmentize -O full -f html -o /liquid-example.html example.liquid`.
|
|
2
|
+
|
|
3
|
+
{% raw %}
|
|
4
|
+
some {{raw}} liquid syntax
|
|
5
|
+
|
|
6
|
+
{% raw %}
|
|
7
|
+
{% endraw %}
|
|
8
|
+
|
|
9
|
+
Just regular text - what happens?
|
|
10
|
+
|
|
11
|
+
{% comment %}My lovely {{comment}} {% comment %}{% endcomment %}
|
|
12
|
+
|
|
13
|
+
{% custom_tag params: true %}
|
|
14
|
+
{% custom_block my="abc" c = false %}
|
|
15
|
+
Just usual {{liquid}}.
|
|
16
|
+
{% endcustom_block %}
|
|
17
|
+
|
|
18
|
+
{% another_tag "my string param" %}
|
|
19
|
+
|
|
20
|
+
{{ variable | upcase }}
|
|
21
|
+
{{ var.field | textilize | markdownify }}
|
|
22
|
+
{{ var.field.property | textilize | markdownify }}
|
|
23
|
+
{{ 'string' | truncate: 100 param='df"g' }}
|
|
24
|
+
|
|
25
|
+
{% cycle '1', 2, var %}
|
|
26
|
+
{% cycle 'group1': '1', var, 2 %}
|
|
27
|
+
{% cycle group2: '1', var, 2 %}
|
|
28
|
+
|
|
29
|
+
{% if a == 'B' %}
|
|
30
|
+
{% elsif a == 'C%}' %}
|
|
31
|
+
{% else %}
|
|
32
|
+
{% endif %}
|
|
33
|
+
|
|
34
|
+
{% unless not a %}
|
|
35
|
+
{% else %}
|
|
36
|
+
{% endunless %}
|
|
37
|
+
|
|
38
|
+
{% case a %}
|
|
39
|
+
{% when 'B' %}
|
|
40
|
+
{% when 'C' %}
|
|
41
|
+
{% else %}
|
|
42
|
+
{% endcase %}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
//+------------------------------------------------------------------+
|
|
2
|
+
//| PeriodConverter.mq4 |
|
|
3
|
+
//| Copyright 2006-2014, MetaQuotes Software Corp. |
|
|
4
|
+
//| http://www.metaquotes.net |
|
|
5
|
+
//+------------------------------------------------------------------+
|
|
6
|
+
#property copyright "2006-2014, MetaQuotes Software Corp."
|
|
7
|
+
#property link "http://www.mql4.com"
|
|
8
|
+
#property description "Period Converter to updated format of history base"
|
|
9
|
+
#property strict
|
|
10
|
+
#property show_inputs
|
|
11
|
+
#include <WinUser32.mqh>
|
|
12
|
+
|
|
13
|
+
input int InpPeriodMultiplier=3; // Period multiplier factor
|
|
14
|
+
int ExtHandle=-1;
|
|
15
|
+
//+------------------------------------------------------------------+
|
|
16
|
+
//| script program start function |
|
|
17
|
+
//+------------------------------------------------------------------+
|
|
18
|
+
void OnStart()
|
|
19
|
+
{
|
|
20
|
+
datetime time0;
|
|
21
|
+
ulong last_fpos=0;
|
|
22
|
+
long last_volume=0;
|
|
23
|
+
int i,start_pos,periodseconds;
|
|
24
|
+
int hwnd=0,cnt=0;
|
|
25
|
+
//---- History header
|
|
26
|
+
int file_version=401;
|
|
27
|
+
string c_copyright;
|
|
28
|
+
string c_symbol=Symbol();
|
|
29
|
+
int i_period=Period()*InpPeriodMultiplier;
|
|
30
|
+
int i_digits=Digits;
|
|
31
|
+
int i_unused[13];
|
|
32
|
+
MqlRates rate;
|
|
33
|
+
//---
|
|
34
|
+
ExtHandle=FileOpenHistory(c_symbol+(string)i_period+".hst",FILE_BIN|FILE_WRITE|FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_ANSI);
|
|
35
|
+
if(ExtHandle<0)
|
|
36
|
+
return;
|
|
37
|
+
c_copyright="(C)opyright 2003, MetaQuotes Software Corp.";
|
|
38
|
+
ArrayInitialize(i_unused,0);
|
|
39
|
+
//--- write history file header
|
|
40
|
+
FileWriteInteger(ExtHandle,file_version,LONG_VALUE);
|
|
41
|
+
FileWriteString(ExtHandle,c_copyright,64);
|
|
42
|
+
FileWriteString(ExtHandle,c_symbol,12);
|
|
43
|
+
FileWriteInteger(ExtHandle,i_period,LONG_VALUE);
|
|
44
|
+
FileWriteInteger(ExtHandle,i_digits,LONG_VALUE);
|
|
45
|
+
FileWriteInteger(ExtHandle,0,LONG_VALUE);
|
|
46
|
+
FileWriteInteger(ExtHandle,0,LONG_VALUE);
|
|
47
|
+
FileWriteArray(ExtHandle,i_unused,0,13);
|
|
48
|
+
//--- write history file
|
|
49
|
+
periodseconds=i_period*60;
|
|
50
|
+
start_pos=Bars-1;
|
|
51
|
+
rate.open=Open[start_pos];
|
|
52
|
+
rate.low=Low[start_pos];
|
|
53
|
+
rate.high=High[start_pos];
|
|
54
|
+
rate.tick_volume=(long)Volume[start_pos];
|
|
55
|
+
rate.spread=0;
|
|
56
|
+
rate.real_volume=0;
|
|
57
|
+
//--- normalize open time
|
|
58
|
+
rate.time=Time[start_pos]/periodseconds;
|
|
59
|
+
rate.time*=periodseconds;
|
|
60
|
+
for(i=start_pos-1; i>=0; i--)
|
|
61
|
+
{
|
|
62
|
+
if(IsStopped())
|
|
63
|
+
break;
|
|
64
|
+
time0=Time[i];
|
|
65
|
+
//--- history may be updated
|
|
66
|
+
if(i==0)
|
|
67
|
+
{
|
|
68
|
+
//--- modify index if history was updated
|
|
69
|
+
if(RefreshRates())
|
|
70
|
+
i=iBarShift(NULL,0,time0);
|
|
71
|
+
}
|
|
72
|
+
//---
|
|
73
|
+
if(time0>=rate.time+periodseconds || i==0)
|
|
74
|
+
{
|
|
75
|
+
if(i==0 && time0<rate.time+periodseconds)
|
|
76
|
+
{
|
|
77
|
+
rate.tick_volume+=(long)Volume[0];
|
|
78
|
+
if(rate.low>Low[0])
|
|
79
|
+
rate.low=Low[0];
|
|
80
|
+
if(rate.high<High[0])
|
|
81
|
+
rate.high=High[0];
|
|
82
|
+
rate.close=Close[0];
|
|
83
|
+
}
|
|
84
|
+
last_fpos=FileTell(ExtHandle);
|
|
85
|
+
last_volume=(long)Volume[i];
|
|
86
|
+
FileWriteStruct(ExtHandle,rate);
|
|
87
|
+
cnt++;
|
|
88
|
+
if(time0>=rate.time+periodseconds)
|
|
89
|
+
{
|
|
90
|
+
rate.time=time0/periodseconds;
|
|
91
|
+
rate.time*=periodseconds;
|
|
92
|
+
rate.open=Open[i];
|
|
93
|
+
rate.low=Low[i];
|
|
94
|
+
rate.high=High[i];
|
|
95
|
+
rate.close=Close[i];
|
|
96
|
+
rate.tick_volume=last_volume;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else
|
|
100
|
+
{
|
|
101
|
+
rate.tick_volume+=(long)Volume[i];
|
|
102
|
+
if(rate.low>Low[i])
|
|
103
|
+
rate.low=Low[i];
|
|
104
|
+
if(rate.high<High[i])
|
|
105
|
+
rate.high=High[i];
|
|
106
|
+
rate.close=Close[i];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
FileFlush(ExtHandle);
|
|
110
|
+
Print(cnt," record(s) written");
|
|
111
|
+
//--- collect incoming ticks
|
|
112
|
+
datetime last_time=LocalTime()-5;
|
|
113
|
+
while(!IsStopped())
|
|
114
|
+
{
|
|
115
|
+
datetime cur_time=LocalTime();
|
|
116
|
+
//--- check for new rates
|
|
117
|
+
if(RefreshRates())
|
|
118
|
+
{
|
|
119
|
+
time0=Time[0];
|
|
120
|
+
FileSeek(ExtHandle,last_fpos,SEEK_SET);
|
|
121
|
+
//--- is there current bar?
|
|
122
|
+
if(time0<rate.time+periodseconds)
|
|
123
|
+
{
|
|
124
|
+
rate.tick_volume+=(long)Volume[0]-last_volume;
|
|
125
|
+
last_volume=(long)Volume[0];
|
|
126
|
+
if(rate.low>Low[0])
|
|
127
|
+
rate.low=Low[0];
|
|
128
|
+
if(rate.high<High[0])
|
|
129
|
+
rate.high=High[0];
|
|
130
|
+
rate.close=Close[0];
|
|
131
|
+
}
|
|
132
|
+
else
|
|
133
|
+
{
|
|
134
|
+
//--- no, there is new bar
|
|
135
|
+
rate.tick_volume+=(long)Volume[1]-last_volume;
|
|
136
|
+
if(rate.low>Low[1])
|
|
137
|
+
rate.low=Low[1];
|
|
138
|
+
if(rate.high<High[1])
|
|
139
|
+
rate.high=High[1];
|
|
140
|
+
//--- write previous bar remains
|
|
141
|
+
FileWriteStruct(ExtHandle,rate);
|
|
142
|
+
last_fpos=FileTell(ExtHandle);
|
|
143
|
+
//----
|
|
144
|
+
rate.time=time0/periodseconds;
|
|
145
|
+
rate.time*=periodseconds;
|
|
146
|
+
rate.open=Open[0];
|
|
147
|
+
rate.low=Low[0];
|
|
148
|
+
rate.high=High[0];
|
|
149
|
+
rate.close=Close[0];
|
|
150
|
+
rate.tick_volume=(long)Volume[0];
|
|
151
|
+
last_volume=rate.tick_volume;
|
|
152
|
+
}
|
|
153
|
+
//----
|
|
154
|
+
FileWriteStruct(ExtHandle,rate);
|
|
155
|
+
FileFlush(ExtHandle);
|
|
156
|
+
//---
|
|
157
|
+
if(hwnd==0)
|
|
158
|
+
{
|
|
159
|
+
hwnd=WindowHandle(Symbol(),i_period);
|
|
160
|
+
if(hwnd!=0)
|
|
161
|
+
Print("Chart window detected");
|
|
162
|
+
}
|
|
163
|
+
//--- refresh window not frequently than 1 time in 2 seconds
|
|
164
|
+
if(hwnd!=0 && cur_time-last_time>=2)
|
|
165
|
+
{
|
|
166
|
+
PostMessageA(hwnd,WM_COMMAND,33324,0);
|
|
167
|
+
last_time=cur_time;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
Sleep(50);
|
|
171
|
+
}
|
|
172
|
+
//---
|
|
173
|
+
}
|
|
174
|
+
//+------------------------------------------------------------------+
|
|
175
|
+
//| |
|
|
176
|
+
//+------------------------------------------------------------------+
|
|
177
|
+
void OnDeinit(const int reason)
|
|
178
|
+
{
|
|
179
|
+
//---
|
|
180
|
+
if(ExtHandle>=0)
|
|
181
|
+
{
|
|
182
|
+
FileClose(ExtHandle);
|
|
183
|
+
ExtHandle=-1;
|
|
184
|
+
}
|
|
185
|
+
//---
|
|
186
|
+
}
|
|
187
|
+
//+------------------------------------------------------------------+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
//+------------------------------------------------------------------+
|
|
2
|
+
//| Array.mqh |
|
|
3
|
+
//| Copyright 2009-2013, MetaQuotes Software Corp. |
|
|
4
|
+
//| http://www.mql4.com |
|
|
5
|
+
//+------------------------------------------------------------------+
|
|
6
|
+
#include <Object.mqh>
|
|
7
|
+
//+------------------------------------------------------------------+
|
|
8
|
+
//| Class CArray |
|
|
9
|
+
//| Purpose: Base class of dynamic arrays. |
|
|
10
|
+
//| Derives from class CObject. |
|
|
11
|
+
//+------------------------------------------------------------------+
|
|
12
|
+
class CArray : public CObject
|
|
13
|
+
{
|
|
14
|
+
protected:
|
|
15
|
+
int m_step_resize; // increment size of the array
|
|
16
|
+
int m_data_total; // number of elements
|
|
17
|
+
int m_data_max; // maximmum size of the array without memory reallocation
|
|
18
|
+
int m_sort_mode; // mode of array sorting
|
|
19
|
+
|
|
20
|
+
public:
|
|
21
|
+
CArray(void);
|
|
22
|
+
~CArray(void);
|
|
23
|
+
//--- methods of access to protected data
|
|
24
|
+
int Step(void) const { return(m_step_resize); }
|
|
25
|
+
bool Step(const int step);
|
|
26
|
+
int Total(void) const { return(m_data_total); }
|
|
27
|
+
int Available(void) const { return(m_data_max-m_data_total); }
|
|
28
|
+
int Max(void) const { return(m_data_max); }
|
|
29
|
+
bool IsSorted(const int mode=0) const { return(m_sort_mode==mode); }
|
|
30
|
+
int SortMode(void) const { return(m_sort_mode); }
|
|
31
|
+
//--- cleaning method
|
|
32
|
+
void Clear(void) { m_data_total=0; }
|
|
33
|
+
//--- methods for working with files
|
|
34
|
+
virtual bool Save(const int file_handle);
|
|
35
|
+
virtual bool Load(const int file_handle);
|
|
36
|
+
//--- sorting method
|
|
37
|
+
void Sort(const int mode=0);
|
|
38
|
+
|
|
39
|
+
protected:
|
|
40
|
+
virtual void QuickSort(int beg,int end,const int mode=0) { }
|
|
41
|
+
};
|
|
42
|
+
//+------------------------------------------------------------------+
|
|
43
|
+
//| Constructor |
|
|
44
|
+
//+------------------------------------------------------------------+
|
|
45
|
+
CArray::CArray(void) : m_step_resize(16),
|
|
46
|
+
m_data_total(0),
|
|
47
|
+
m_data_max(0),
|
|
48
|
+
m_sort_mode(-1)
|
|
49
|
+
{
|
|
50
|
+
}
|
|
51
|
+
//+------------------------------------------------------------------+
|
|
52
|
+
//| Destructor |
|
|
53
|
+
//+------------------------------------------------------------------+
|
|
54
|
+
CArray::~CArray(void)
|
|
55
|
+
{
|
|
56
|
+
}
|
|
57
|
+
//+------------------------------------------------------------------+
|
|
58
|
+
//| Method Set for variable m_step_resize |
|
|
59
|
+
//+------------------------------------------------------------------+
|
|
60
|
+
bool CArray::Step(const int step)
|
|
61
|
+
{
|
|
62
|
+
//--- check
|
|
63
|
+
if(step>0)
|
|
64
|
+
{
|
|
65
|
+
m_step_resize=step;
|
|
66
|
+
return(true);
|
|
67
|
+
}
|
|
68
|
+
//--- failure
|
|
69
|
+
return(false);
|
|
70
|
+
}
|
|
71
|
+
//+------------------------------------------------------------------+
|
|
72
|
+
//| Sorting an array in ascending order |
|
|
73
|
+
//+------------------------------------------------------------------+
|
|
74
|
+
void CArray::Sort(const int mode)
|
|
75
|
+
{
|
|
76
|
+
//--- check
|
|
77
|
+
if(IsSorted(mode))
|
|
78
|
+
return;
|
|
79
|
+
m_sort_mode=mode;
|
|
80
|
+
if(m_data_total<=1)
|
|
81
|
+
return;
|
|
82
|
+
//--- sort
|
|
83
|
+
QuickSort(0,m_data_total-1,mode);
|
|
84
|
+
}
|
|
85
|
+
//+------------------------------------------------------------------+
|
|
86
|
+
//| Writing header of array to file |
|
|
87
|
+
//+------------------------------------------------------------------+
|
|
88
|
+
bool CArray::Save(const int file_handle)
|
|
89
|
+
{
|
|
90
|
+
//--- check handle
|
|
91
|
+
if(file_handle!=INVALID_HANDLE)
|
|
92
|
+
{
|
|
93
|
+
//--- write start marker - 0xFFFFFFFFFFFFFFFF
|
|
94
|
+
if(FileWriteLong(file_handle,-1)==sizeof(long))
|
|
95
|
+
{
|
|
96
|
+
//--- write array type
|
|
97
|
+
if(FileWriteInteger(file_handle,Type(),INT_VALUE)==INT_VALUE)
|
|
98
|
+
return(true);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//--- failure
|
|
102
|
+
return(false);
|
|
103
|
+
}
|
|
104
|
+
//+------------------------------------------------------------------+
|
|
105
|
+
//| Reading header of array from file |
|
|
106
|
+
//+------------------------------------------------------------------+
|
|
107
|
+
bool CArray::Load(const int file_handle)
|
|
108
|
+
{
|
|
109
|
+
//--- check handle
|
|
110
|
+
if(file_handle!=INVALID_HANDLE)
|
|
111
|
+
{
|
|
112
|
+
//--- read and check start marker - 0xFFFFFFFFFFFFFFFF
|
|
113
|
+
if(FileReadLong(file_handle)==-1)
|
|
114
|
+
{
|
|
115
|
+
//--- read and check array type
|
|
116
|
+
if(FileReadInteger(file_handle,INT_VALUE)==Type())
|
|
117
|
+
return(true);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//--- failure
|
|
121
|
+
return(false);
|
|
122
|
+
}
|
|
123
|
+
//+------------------------------------------------------------------+
|