pygments.rb 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,253 @@
|
|
1
|
+
#include <core>
|
2
|
+
|
3
|
+
// Single line comment
|
4
|
+
/* Multi line
|
5
|
+
comment */
|
6
|
+
|
7
|
+
/// documentation
|
8
|
+
/**
|
9
|
+
|
10
|
+
documentation multi line
|
11
|
+
|
12
|
+
**/
|
13
|
+
|
14
|
+
public OnGameModeInit() {
|
15
|
+
printf("Hello, World!");
|
16
|
+
}
|
17
|
+
|
18
|
+
enum info {
|
19
|
+
Float:ex;
|
20
|
+
exa,
|
21
|
+
exam[5],
|
22
|
+
}
|
23
|
+
new arr[5][info];
|
24
|
+
|
25
|
+
stock Float:test_func()
|
26
|
+
{
|
27
|
+
new a = 5, Float:b = 10.3;
|
28
|
+
if (a == b) {
|
29
|
+
|
30
|
+
} else {
|
31
|
+
|
32
|
+
}
|
33
|
+
|
34
|
+
for (new i = 0; i < 10; i++) {
|
35
|
+
continue;
|
36
|
+
}
|
37
|
+
|
38
|
+
do {
|
39
|
+
a--;
|
40
|
+
} while (a > 0);
|
41
|
+
|
42
|
+
while (a < 5) {
|
43
|
+
a++;
|
44
|
+
break;
|
45
|
+
}
|
46
|
+
|
47
|
+
switch (a) {
|
48
|
+
case 0: {
|
49
|
+
}
|
50
|
+
case 0..4: {
|
51
|
+
}
|
52
|
+
case 5, 6: {
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
static x;
|
57
|
+
new xx = a > 5 ? 5 : 0;
|
58
|
+
new array[sizeof arr] = {0};
|
59
|
+
tagof a;
|
60
|
+
state a;
|
61
|
+
goto label;
|
62
|
+
new byte[2 char];
|
63
|
+
byte{0} = 'a';
|
64
|
+
|
65
|
+
return (float(a) + b);
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
// float.inc
|
70
|
+
/* Float arithmetic
|
71
|
+
*
|
72
|
+
* (c) Copyright 1999, Artran, Inc.
|
73
|
+
* Written by Greg Garner (gmg@artran.com)
|
74
|
+
* Modified in March 2001 to include user defined
|
75
|
+
* operators for the floating point functions.
|
76
|
+
*
|
77
|
+
* This file is provided as is (no warranties).
|
78
|
+
*/
|
79
|
+
#if defined _Float_included
|
80
|
+
#endinput
|
81
|
+
#endif
|
82
|
+
#define _Float_included
|
83
|
+
#pragma library Float
|
84
|
+
|
85
|
+
/* Different methods of rounding */
|
86
|
+
enum floatround_method {
|
87
|
+
floatround_round,
|
88
|
+
floatround_floor,
|
89
|
+
floatround_ceil,
|
90
|
+
floatround_tozero,
|
91
|
+
floatround_unbiased
|
92
|
+
}
|
93
|
+
enum anglemode {
|
94
|
+
radian,
|
95
|
+
degrees,
|
96
|
+
grades
|
97
|
+
}
|
98
|
+
|
99
|
+
/**************************************************/
|
100
|
+
/* Convert an integer into a floating point value */
|
101
|
+
native Float:float(value);
|
102
|
+
|
103
|
+
/**************************************************/
|
104
|
+
/* Convert a string into a floating point value */
|
105
|
+
native Float:floatstr(const string[]);
|
106
|
+
|
107
|
+
/**************************************************/
|
108
|
+
/* Multiple two floats together */
|
109
|
+
native Float:floatmul(Float:oper1, Float:oper2);
|
110
|
+
|
111
|
+
/**************************************************/
|
112
|
+
/* Divide the dividend float by the divisor float */
|
113
|
+
native Float:floatdiv(Float:dividend, Float:divisor);
|
114
|
+
|
115
|
+
/**************************************************/
|
116
|
+
/* Add two floats together */
|
117
|
+
native Float:floatadd(Float:oper1, Float:oper2);
|
118
|
+
|
119
|
+
/**************************************************/
|
120
|
+
/* Subtract oper2 float from oper1 float */
|
121
|
+
native Float:floatsub(Float:oper1, Float:oper2);
|
122
|
+
|
123
|
+
/**************************************************/
|
124
|
+
/* Return the fractional part of a float */
|
125
|
+
native Float:floatfract(Float:value);
|
126
|
+
|
127
|
+
/**************************************************/
|
128
|
+
/* Round a float into a integer value */
|
129
|
+
native floatround(Float:value, floatround_method:method=floatround_round);
|
130
|
+
|
131
|
+
/**************************************************/
|
132
|
+
/* Compare two integers. If the two elements are equal, return 0.
|
133
|
+
If the first argument is greater than the second argument, return 1,
|
134
|
+
If the first argument is less than the second argument, return -1. */
|
135
|
+
native floatcmp(Float:oper1, Float:oper2);
|
136
|
+
|
137
|
+
/**************************************************/
|
138
|
+
/* Return the square root of the input value, same as floatpower(value, 0.5) */
|
139
|
+
native Float:floatsqroot(Float:value);
|
140
|
+
|
141
|
+
/**************************************************/
|
142
|
+
/* Return the value raised to the power of the exponent */
|
143
|
+
native Float:floatpower(Float:value, Float:exponent);
|
144
|
+
|
145
|
+
/**************************************************/
|
146
|
+
/* Return the logarithm */
|
147
|
+
native Float:floatlog(Float:value, Float:base=10.0);
|
148
|
+
|
149
|
+
/**************************************************/
|
150
|
+
/* Return the sine, cosine or tangent. The input angle may be in radian,
|
151
|
+
degrees or grades. */
|
152
|
+
native Float:floatsin(Float:value, anglemode:mode=radian);
|
153
|
+
native Float:floatcos(Float:value, anglemode:mode=radian);
|
154
|
+
native Float:floattan(Float:value, anglemode:mode=radian);
|
155
|
+
|
156
|
+
/**************************************************/
|
157
|
+
/* Return the absolute value */
|
158
|
+
native Float:floatabs(Float:value);
|
159
|
+
|
160
|
+
|
161
|
+
/**************************************************/
|
162
|
+
#pragma rational Float
|
163
|
+
|
164
|
+
/* user defined operators */
|
165
|
+
native Float:operator*(Float:oper1, Float:oper2) = floatmul;
|
166
|
+
native Float:operator/(Float:oper1, Float:oper2) = floatdiv;
|
167
|
+
native Float:operator+(Float:oper1, Float:oper2) = floatadd;
|
168
|
+
native Float:operator-(Float:oper1, Float:oper2) = floatsub;
|
169
|
+
native Float:operator=(oper) = float;
|
170
|
+
|
171
|
+
stock Float:operator++(Float:oper)
|
172
|
+
return oper+1.0;
|
173
|
+
|
174
|
+
stock Float:operator--(Float:oper)
|
175
|
+
return oper-1.0;
|
176
|
+
|
177
|
+
stock Float:operator-(Float:oper)
|
178
|
+
return oper^Float:cellmin; /* IEEE values are sign/magnitude */
|
179
|
+
|
180
|
+
stock Float:operator*(Float:oper1, oper2)
|
181
|
+
return floatmul(oper1, float(oper2)); /* "*" is commutative */
|
182
|
+
|
183
|
+
stock Float:operator/(Float:oper1, oper2)
|
184
|
+
return floatdiv(oper1, float(oper2));
|
185
|
+
|
186
|
+
stock Float:operator/(oper1, Float:oper2)
|
187
|
+
return floatdiv(float(oper1), oper2);
|
188
|
+
|
189
|
+
stock Float:operator+(Float:oper1, oper2)
|
190
|
+
return floatadd(oper1, float(oper2)); /* "+" is commutative */
|
191
|
+
|
192
|
+
stock Float:operator-(Float:oper1, oper2)
|
193
|
+
return floatsub(oper1, float(oper2));
|
194
|
+
|
195
|
+
stock Float:operator-(oper1, Float:oper2)
|
196
|
+
return floatsub(float(oper1), oper2);
|
197
|
+
|
198
|
+
stock bool:operator==(Float:oper1, Float:oper2)
|
199
|
+
return floatcmp(oper1, oper2) == 0;
|
200
|
+
|
201
|
+
stock bool:operator==(Float:oper1, oper2)
|
202
|
+
return floatcmp(oper1, float(oper2)) == 0; /* "==" is commutative */
|
203
|
+
|
204
|
+
stock bool:operator!=(Float:oper1, Float:oper2)
|
205
|
+
return floatcmp(oper1, oper2) != 0;
|
206
|
+
|
207
|
+
stock bool:operator!=(Float:oper1, oper2)
|
208
|
+
return floatcmp(oper1, float(oper2)) != 0; /* "!=" is commutative */
|
209
|
+
|
210
|
+
stock bool:operator>(Float:oper1, Float:oper2)
|
211
|
+
return floatcmp(oper1, oper2) > 0;
|
212
|
+
|
213
|
+
stock bool:operator>(Float:oper1, oper2)
|
214
|
+
return floatcmp(oper1, float(oper2)) > 0;
|
215
|
+
|
216
|
+
stock bool:operator>(oper1, Float:oper2)
|
217
|
+
return floatcmp(float(oper1), oper2) > 0;
|
218
|
+
|
219
|
+
stock bool:operator>=(Float:oper1, Float:oper2)
|
220
|
+
return floatcmp(oper1, oper2) >= 0;
|
221
|
+
|
222
|
+
stock bool:operator>=(Float:oper1, oper2)
|
223
|
+
return floatcmp(oper1, float(oper2)) >= 0;
|
224
|
+
|
225
|
+
stock bool:operator>=(oper1, Float:oper2)
|
226
|
+
return floatcmp(float(oper1), oper2) >= 0;
|
227
|
+
|
228
|
+
stock bool:operator<(Float:oper1, Float:oper2)
|
229
|
+
return floatcmp(oper1, oper2) < 0;
|
230
|
+
|
231
|
+
stock bool:operator<(Float:oper1, oper2)
|
232
|
+
return floatcmp(oper1, float(oper2)) < 0;
|
233
|
+
|
234
|
+
stock bool:operator<(oper1, Float:oper2)
|
235
|
+
return floatcmp(float(oper1), oper2) < 0;
|
236
|
+
|
237
|
+
stock bool:operator<=(Float:oper1, Float:oper2)
|
238
|
+
return floatcmp(oper1, oper2) <= 0;
|
239
|
+
|
240
|
+
stock bool:operator<=(Float:oper1, oper2)
|
241
|
+
return floatcmp(oper1, float(oper2)) <= 0;
|
242
|
+
|
243
|
+
stock bool:operator<=(oper1, Float:oper2)
|
244
|
+
return floatcmp(float(oper1), oper2) <= 0;
|
245
|
+
|
246
|
+
stock bool:operator!(Float:oper)
|
247
|
+
return (_:oper & cellmax) == 0;
|
248
|
+
|
249
|
+
/* forbidden operations */
|
250
|
+
forward operator%(Float:oper1, Float:oper2);
|
251
|
+
forward operator%(Float:oper1, oper2);
|
252
|
+
forward operator%(oper1, Float:oper2);
|
253
|
+
|
@@ -1,3 +1,9 @@
|
|
1
|
+
preface.... everything what is before header is not evaluated
|
2
|
+
so this should not be colorized:
|
3
|
+
1 + 2
|
4
|
+
|
5
|
+
REBOL [] ;<- this is minimal header, everything behind it must be colorized
|
6
|
+
|
1
7
|
;## String tests ##
|
2
8
|
print "Hello ^"World" ;<- with escaped char
|
3
9
|
multiline-string: {
|
@@ -52,15 +58,29 @@ type? #ff0000 ;== issue!
|
|
52
58
|
to integer! (1 + (x / 4.5) * 1E-4)
|
53
59
|
|
54
60
|
;## some spec comments
|
55
|
-
|
56
|
-
comment
|
61
|
+
1 + 1
|
62
|
+
comment "aa"
|
63
|
+
2 + 2
|
64
|
+
comment {aa}
|
65
|
+
3 + 3
|
66
|
+
comment {a^{}
|
67
|
+
4 + 4
|
68
|
+
comment {{}}
|
69
|
+
5 + 5
|
57
70
|
comment {
|
58
|
-
|
59
|
-
bla
|
71
|
+
foo: 6
|
60
72
|
}
|
61
|
-
|
62
|
-
|
63
|
-
|
73
|
+
6 + 6
|
74
|
+
comment [foo: 6]
|
75
|
+
7 + 7
|
76
|
+
comment [foo: "[" ]
|
77
|
+
8 + 8
|
78
|
+
comment [foo: {^{} ]
|
79
|
+
9 + 9
|
80
|
+
comment [foo: {boo} ]
|
81
|
+
10 + 10
|
82
|
+
comment 5-May-2014/11:17:34+2:00
|
83
|
+
5-May-2014/11:17:34+2:00 11 + 11
|
64
84
|
|
65
85
|
;## other tests ##
|
66
86
|
---: 1
|
@@ -0,0 +1,111 @@
|
|
1
|
+
scheme COMPILER =
|
2
|
+
class
|
3
|
+
type
|
4
|
+
Prog == mk_Prog(stmt : Stmt),
|
5
|
+
|
6
|
+
Stmt ==
|
7
|
+
mk_Asgn(ide : Identifier, expr : Expr) |
|
8
|
+
mk_If(cond : Expr, s1 : Stmt, s2 : Stmt) |
|
9
|
+
mk_Seq(head : Stmt, last : Stmt),
|
10
|
+
|
11
|
+
Expr ==
|
12
|
+
mk_Const(const : Int) |
|
13
|
+
mk_Plus(fst : Expr, snd : Expr) |
|
14
|
+
mk_Id(ide : Identifier),
|
15
|
+
Identifier = Text
|
16
|
+
|
17
|
+
type /* storage for program variables */
|
18
|
+
`Sigma = Identifier -m-> Int
|
19
|
+
|
20
|
+
value
|
21
|
+
m : Prog -> `Sigma -> `Sigma
|
22
|
+
m(p)(`sigma) is m(stmt(p))(`sigma),
|
23
|
+
|
24
|
+
m : Stmt -> `Sigma -> `Sigma
|
25
|
+
m(s)(`sigma) is
|
26
|
+
case s of
|
27
|
+
mk_Asgn(i, e) -> `sigma !! [i +> m(e)(`sigma)],
|
28
|
+
mk_Seq(s1, s2) -> m(s2)(m(s1)(`sigma)),
|
29
|
+
mk_If(c, s1, s2) ->
|
30
|
+
if m(c)(`sigma) ~= 0 then m(s1)(`sigma) else m(s2)(`sigma) end
|
31
|
+
end,
|
32
|
+
|
33
|
+
m : Expr -> `Sigma -> Int
|
34
|
+
m(e)(`sigma) is
|
35
|
+
case e of
|
36
|
+
mk_Const(n) -> n,
|
37
|
+
mk_Plus(e1, e2) -> m(e1)(`sigma) + m(e2)(`sigma),
|
38
|
+
mk_Id(id) -> if id isin dom `sigma then `sigma(id) else 0 end
|
39
|
+
end
|
40
|
+
|
41
|
+
type
|
42
|
+
MProg = Inst-list,
|
43
|
+
Inst ==
|
44
|
+
mk_Push(ide1 : Identifier) |
|
45
|
+
mk_Pop(Unit) |
|
46
|
+
mk_Add(Unit) |
|
47
|
+
mk_Cnst(val : Int) |
|
48
|
+
mk_Store(ide2 : Identifier) |
|
49
|
+
mk_Jumpfalse(off1 : Int) |
|
50
|
+
mk_Jump(off2 : Int)
|
51
|
+
|
52
|
+
|
53
|
+
/* An interpreter for SMALL instructions */
|
54
|
+
|
55
|
+
type Stack = Int-list
|
56
|
+
value
|
57
|
+
I : MProg >< Int >< Stack -> (`Sigma ->`Sigma)
|
58
|
+
I(mp, pc, s)(`sigma) is
|
59
|
+
if pc <= 0 \/ pc > len mp then `sigma else
|
60
|
+
case mp(pc) of
|
61
|
+
mk_Push(x) -> if x isin dom `sigma
|
62
|
+
then I(mp, pc + 1, <.`sigma(x).> ^ s)(`sigma)
|
63
|
+
else I(mp, pc + 1, <.0.> ^ s)(`sigma) end,
|
64
|
+
mk_Pop(()) -> if len s = 0 then `sigma
|
65
|
+
else I(mp, pc + 1, tl s)(`sigma) end,
|
66
|
+
mk_Cnst(n) -> I(mp, pc + 1, <.n.> ^ s)(`sigma),
|
67
|
+
mk_Add(()) -> if len s < 2 then `sigma
|
68
|
+
else I(mp, pc + 1,<.s(1) + s(2).> ^ tl tl s)(`sigma) end,
|
69
|
+
mk_Store(x) -> if len s = 0 then `sigma
|
70
|
+
else I(mp, pc + 1, s)(`sigma !! [x +> s(1)]) end,
|
71
|
+
mk_Jumpfalse(n) -> if len s = 0 then `sigma
|
72
|
+
elsif hd s ~= 0 then I(mp, pc + 1, s)(`sigma)
|
73
|
+
else I(mp, pc + n, s)(`sigma) end,
|
74
|
+
mk_Jump(n) -> I(mp, pc + n, s)(`sigma)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
value
|
79
|
+
comp_Prog : Prog -> MProg
|
80
|
+
comp_Prog(p) is comp_Stmt(stmt(p)),
|
81
|
+
|
82
|
+
comp_Stmt : Stmt -> MProg
|
83
|
+
comp_Stmt(s) is
|
84
|
+
case s of
|
85
|
+
mk_Asgn(id, e) -> comp_Expr(e) ^ <. mk_Store(id), mk_Pop() .>,
|
86
|
+
mk_Seq(s1, s2) -> comp_Stmt(s1) ^ comp_Stmt(s2),
|
87
|
+
mk_If(e, s1, s2) ->
|
88
|
+
let
|
89
|
+
ce = comp_Expr(e),
|
90
|
+
cs1 = comp_Stmt(s1), cs2 = comp_Stmt(s2)
|
91
|
+
in
|
92
|
+
ce ^
|
93
|
+
<. mk_Jumpfalse(len cs1 + 3) .> ^
|
94
|
+
<. mk_Pop() .> ^
|
95
|
+
cs1 ^
|
96
|
+
<. mk_Jump(len cs2 + 2) .> ^
|
97
|
+
<. mk_Pop() .> ^
|
98
|
+
cs2
|
99
|
+
end
|
100
|
+
end,
|
101
|
+
|
102
|
+
comp_Expr : Expr -> MProg
|
103
|
+
comp_Expr(e) is
|
104
|
+
case e of
|
105
|
+
mk_Const(n) -> <. mk_Cnst(n) .>,
|
106
|
+
mk_Plus(e1, e2) ->
|
107
|
+
comp_Expr(e1) ^ comp_Expr(e2) ^ <. mk_Add() .>,
|
108
|
+
mk_Id(id) -> <. mk_Push(id) .>
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
//
|
2
|
+
// test.swift
|
3
|
+
// from https://github.com/fullstackio/FlappySwift
|
4
|
+
//
|
5
|
+
// Created by Nate Murray on 6/2/14.
|
6
|
+
// Copyright (c) 2014 Fullstack.io. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
import UIKit
|
10
|
+
import SpriteKit
|
11
|
+
|
12
|
+
extension SKNode {
|
13
|
+
class func unarchiveFromFile(file : NSString) -> SKNode? {
|
14
|
+
|
15
|
+
let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks")
|
16
|
+
|
17
|
+
var sceneData = NSData.dataWithContentsOfFile(path, options: .DataReadingMappedIfSafe, error: nil)
|
18
|
+
var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData)
|
19
|
+
|
20
|
+
archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene")
|
21
|
+
let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene
|
22
|
+
archiver.finishDecoding()
|
23
|
+
return scene
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
class GameViewController: UIViewController {
|
28
|
+
|
29
|
+
override func viewDidLoad() {
|
30
|
+
super.viewDidLoad()
|
31
|
+
|
32
|
+
if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene {
|
33
|
+
// Configure the view.
|
34
|
+
let skView = self.view as SKView
|
35
|
+
skView.showsFPS = true
|
36
|
+
skView.showsNodeCount = true
|
37
|
+
|
38
|
+
/* Sprite Kit applies additional optimizations to improve rendering performance */
|
39
|
+
skView.ignoresSiblingOrder = true
|
40
|
+
|
41
|
+
/* Set the scale mode to scale to fit the window */
|
42
|
+
scene.scaleMode = .AspectFill
|
43
|
+
|
44
|
+
skView.presentScene(scene)
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
override func shouldAutorotate() -> Bool {
|
49
|
+
return true
|
50
|
+
}
|
51
|
+
|
52
|
+
override func supportedInterfaceOrientations() -> Int {
|
53
|
+
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
|
54
|
+
return Int(UIInterfaceOrientationMask.AllButUpsideDown.toRaw())
|
55
|
+
} else {
|
56
|
+
return Int(UIInterfaceOrientationMask.All.toRaw())
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
override func didReceiveMemoryWarning() {
|
61
|
+
super.didReceiveMemoryWarning()
|
62
|
+
// Release any cached data, images, etc that aren't in use.
|
63
|
+
}
|
64
|
+
|
65
|
+
}
|