gitlab-pygments.rb 0.3.2 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +71 -0
- data/Gemfile +1 -1
- data/LICENSE +17 -0
- data/README.md +28 -1
- data/Rakefile +2 -5
- data/lexers +0 -0
- data/lib/pygments/mentos.py +19 -12
- data/lib/pygments/popen.rb +21 -4
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -0
- data/test/test_pygments.rb +13 -2
- data/vendor/custom_lexers/github.py +206 -3
- data/vendor/pygments-main/AUTHORS +41 -3
- data/vendor/pygments-main/CHANGES +132 -5
- data/vendor/pygments-main/LICENSE +1 -1
- data/vendor/pygments-main/Makefile +1 -1
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/docs/generate.py +1 -1
- data/vendor/pygments-main/docs/src/api.txt +1 -1
- data/vendor/pygments-main/docs/src/index.txt +1 -1
- data/vendor/pygments-main/docs/src/integrate.txt +5 -0
- data/vendor/pygments-main/docs/src/java.txt +70 -0
- data/vendor/pygments-main/docs/src/lexerdevelopment.txt +52 -0
- data/vendor/pygments-main/external/autopygmentize +64 -0
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +144 -0
- data/vendor/pygments-main/external/markdown-processor.py +2 -2
- data/vendor/pygments-main/external/moin-parser.py +1 -1
- data/vendor/pygments-main/external/rst-directive-old.py +1 -1
- data/vendor/pygments-main/external/rst-directive.py +1 -1
- data/vendor/pygments-main/pygmentize +1 -1
- data/vendor/pygments-main/pygments/__init__.py +2 -2
- data/vendor/pygments-main/pygments/cmdline.py +14 -6
- 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 +3 -4
- data/vendor/pygments-main/pygments/formatter.py +4 -1
- data/vendor/pygments-main/pygments/formatters/__init__.py +1 -1
- data/vendor/pygments-main/pygments/formatters/_mapping.py +3 -3
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +73 -2
- data/vendor/pygments-main/pygments/formatters/img.py +2 -2
- data/vendor/pygments-main/pygments/formatters/latex.py +9 -9
- data/vendor/pygments-main/pygments/formatters/other.py +1 -3
- data/vendor/pygments-main/pygments/formatters/rtf.py +1 -1
- data/vendor/pygments-main/pygments/formatters/svg.py +1 -1
- data/vendor/pygments-main/pygments/formatters/terminal.py +1 -1
- data/vendor/pygments-main/pygments/formatters/terminal256.py +1 -1
- data/vendor/pygments-main/pygments/lexer.py +78 -10
- data/vendor/pygments-main/pygments/lexers/__init__.py +13 -2
- data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5172 -0
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_mapping.py +92 -36
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +562 -0
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +2 -2
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +4 -3
- data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +557 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +11 -0
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +360 -0
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -3
- data/vendor/pygments-main/pygments/lexers/agile.py +525 -38
- data/vendor/pygments-main/pygments/lexers/asm.py +45 -7
- data/vendor/pygments-main/pygments/lexers/compiled.py +1257 -425
- data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +97 -62
- data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +931 -32
- data/vendor/pygments-main/pygments/lexers/github.py +206 -3
- data/vendor/pygments-main/pygments/lexers/hdl.py +3 -3
- data/vendor/pygments-main/pygments/lexers/jvm.py +309 -44
- data/vendor/pygments-main/pygments/lexers/math.py +876 -30
- data/vendor/pygments-main/pygments/lexers/other.py +956 -517
- data/vendor/pygments-main/pygments/lexers/parsers.py +85 -2
- data/vendor/pygments-main/pygments/lexers/shell.py +81 -18
- data/vendor/pygments-main/pygments/lexers/special.py +1 -1
- data/vendor/pygments-main/pygments/lexers/sql.py +2 -2
- data/vendor/pygments-main/pygments/lexers/templates.py +119 -8
- data/vendor/pygments-main/pygments/lexers/text.py +155 -15
- data/vendor/pygments-main/pygments/lexers/web.py +1578 -397
- data/vendor/pygments-main/pygments/modeline.py +40 -0
- data/vendor/pygments-main/pygments/plugin.py +1 -1
- data/vendor/pygments-main/pygments/scanner.py +1 -1
- data/vendor/pygments-main/pygments/style.py +1 -1
- data/vendor/pygments-main/pygments/styles/__init__.py +1 -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/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +1 -1
- 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/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/token.py +1 -1
- data/vendor/pygments-main/pygments/unistring.py +36 -26
- data/vendor/pygments-main/pygments/util.py +46 -1
- data/vendor/pygments-main/scripts/check_sources.py +2 -2
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +2 -0
- data/vendor/pygments-main/scripts/find_codetags.py +1 -1
- data/vendor/pygments-main/scripts/find_error.py +5 -6
- data/vendor/pygments-main/setup.cfg +1 -0
- data/vendor/pygments-main/setup.py +6 -4
- data/vendor/pygments-main/tests/examplefiles/BOM.js +1 -0
- data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
- data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
- data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
- data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
- data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +25 -0
- data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +308 -0
- data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
- data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -0
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +89 -4
- data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
- data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
- data/vendor/pygments-main/tests/examplefiles/example.ceylon +52 -0
- data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
- data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -0
- data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
- data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
- data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
- data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
- data/vendor/pygments-main/tests/examplefiles/example.prg +161 -0
- data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
- data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
- data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
- data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -0
- data/vendor/pygments-main/tests/examplefiles/example.stan +108 -0
- data/vendor/pygments-main/tests/examplefiles/example.ts +28 -0
- data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
- data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
- data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +133 -0
- data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
- data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
- data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
- data/vendor/pygments-main/tests/examplefiles/http_request_example +2 -1
- data/vendor/pygments-main/tests/examplefiles/http_response_example +4 -2
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
- data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
- data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
- data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -0
- data/vendor/pygments-main/tests/examplefiles/matlab_sample +5 -2
- data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
- data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
- data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -0
- data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +95 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +7 -0
- data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +163 -0
- data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
- data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
- data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
- data/vendor/pygments-main/tests/examplefiles/rust_example.rs +233 -0
- data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -0
- data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
- data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
- data/vendor/pygments-main/tests/examplefiles/test.R +149 -115
- data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
- data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
- data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
- data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
- data/vendor/pygments-main/tests/examplefiles/test.opa +10 -0
- data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
- data/vendor/pygments-main/tests/examplefiles/test2.pypylog +120 -0
- data/vendor/pygments-main/tests/examplefiles/type.lisp +16 -0
- data/vendor/pygments-main/tests/examplefiles/unix-io.lid +37 -0
- data/vendor/pygments-main/tests/old_run.py +1 -1
- data/vendor/pygments-main/tests/run.py +3 -2
- data/vendor/pygments-main/tests/support/tags +36 -0
- data/vendor/pygments-main/tests/test_basic_api.py +4 -3
- data/vendor/pygments-main/tests/test_clexer.py +1 -1
- data/vendor/pygments-main/tests/test_cmdline.py +1 -1
- data/vendor/pygments-main/tests/test_examplefiles.py +3 -1
- data/vendor/pygments-main/tests/test_html_formatter.py +17 -1
- data/vendor/pygments-main/tests/test_latex_formatter.py +1 -1
- data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
- data/vendor/pygments-main/tests/test_perllexer.py +1 -1
- data/vendor/pygments-main/tests/test_regexlexer.py +1 -1
- data/vendor/pygments-main/tests/test_token.py +1 -1
- data/vendor/pygments-main/tests/test_using_api.py +1 -1
- data/vendor/pygments-main/tests/test_util.py +22 -3
- metadata +84 -16
@@ -0,0 +1,225 @@
|
|
1
|
+
//
|
2
|
+
// std::vector
|
3
|
+
//
|
4
|
+
|
5
|
+
%include <std_container.i>
|
6
|
+
|
7
|
+
// Vector
|
8
|
+
|
9
|
+
%define %std_vector_methods(vector...)
|
10
|
+
%std_sequence_methods(vector)
|
11
|
+
|
12
|
+
void reserve(size_type n);
|
13
|
+
size_type capacity() const;
|
14
|
+
%enddef
|
15
|
+
|
16
|
+
|
17
|
+
%define %std_vector_methods_val(vector...)
|
18
|
+
%std_sequence_methods_val(vector)
|
19
|
+
|
20
|
+
void reserve(size_type n);
|
21
|
+
size_type capacity() const;
|
22
|
+
%enddef
|
23
|
+
|
24
|
+
|
25
|
+
// ------------------------------------------------------------------------
|
26
|
+
// std::vector
|
27
|
+
//
|
28
|
+
// The aim of all that follows would be to integrate std::vector with
|
29
|
+
// as much as possible, namely, to allow the user to pass and
|
30
|
+
// be returned tuples or lists.
|
31
|
+
// const declarations are used to guess the intent of the function being
|
32
|
+
// exported; therefore, the following rationale is applied:
|
33
|
+
//
|
34
|
+
// -- f(std::vector<T>), f(const std::vector<T>&):
|
35
|
+
// the parameter being read-only, either a sequence or a
|
36
|
+
// previously wrapped std::vector<T> can be passed.
|
37
|
+
// -- f(std::vector<T>&), f(std::vector<T>*):
|
38
|
+
// the parameter may be modified; therefore, only a wrapped std::vector
|
39
|
+
// can be passed.
|
40
|
+
// -- std::vector<T> f(), const std::vector<T>& f():
|
41
|
+
// the vector is returned by copy; therefore, a sequence of T:s
|
42
|
+
// is returned which is most easily used in other functions
|
43
|
+
// -- std::vector<T>& f(), std::vector<T>* f():
|
44
|
+
// the vector is returned by reference; therefore, a wrapped std::vector
|
45
|
+
// is returned
|
46
|
+
// -- const std::vector<T>* f(), f(const std::vector<T>*):
|
47
|
+
// for consistency, they expect and return a plain vector pointer.
|
48
|
+
// ------------------------------------------------------------------------
|
49
|
+
|
50
|
+
%{
|
51
|
+
#include <vector>
|
52
|
+
%}
|
53
|
+
|
54
|
+
// exported classes
|
55
|
+
|
56
|
+
|
57
|
+
namespace std {
|
58
|
+
|
59
|
+
template<class _Tp, class _Alloc = allocator< _Tp > >
|
60
|
+
class vector {
|
61
|
+
public:
|
62
|
+
typedef size_t size_type;
|
63
|
+
typedef ptrdiff_t difference_type;
|
64
|
+
typedef _Tp value_type;
|
65
|
+
typedef value_type* pointer;
|
66
|
+
typedef const value_type* const_pointer;
|
67
|
+
typedef _Tp& reference;
|
68
|
+
typedef const _Tp& const_reference;
|
69
|
+
typedef _Alloc allocator_type;
|
70
|
+
|
71
|
+
%traits_swigtype(_Tp);
|
72
|
+
%traits_enum(_Tp);
|
73
|
+
|
74
|
+
%fragment(SWIG_Traits_frag(std::vector<_Tp, _Alloc >), "header",
|
75
|
+
fragment=SWIG_Traits_frag(_Tp),
|
76
|
+
fragment="StdVectorTraits") {
|
77
|
+
namespace swig {
|
78
|
+
template <> struct traits<std::vector<_Tp, _Alloc > > {
|
79
|
+
typedef pointer_category category;
|
80
|
+
static const char* type_name() {
|
81
|
+
return "std::vector<" #_Tp "," #_Alloc " >";
|
82
|
+
}
|
83
|
+
};
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp, _Alloc >);
|
88
|
+
|
89
|
+
#ifdef %swig_vector_methods
|
90
|
+
// Add swig/language extra methods
|
91
|
+
%swig_vector_methods(std::vector<_Tp, _Alloc >);
|
92
|
+
#endif
|
93
|
+
|
94
|
+
%std_vector_methods(vector);
|
95
|
+
};
|
96
|
+
|
97
|
+
// ***
|
98
|
+
// This specialization should disappear or get simplified when
|
99
|
+
// a 'const SWIGTYPE*&' can be defined
|
100
|
+
// ***
|
101
|
+
template<class _Tp, class _Alloc >
|
102
|
+
class vector<_Tp*, _Alloc > {
|
103
|
+
public:
|
104
|
+
typedef size_t size_type;
|
105
|
+
typedef ptrdiff_t difference_type;
|
106
|
+
typedef _Tp* value_type;
|
107
|
+
typedef value_type* pointer;
|
108
|
+
typedef const value_type* const_pointer;
|
109
|
+
typedef value_type reference;
|
110
|
+
typedef value_type const_reference;
|
111
|
+
typedef _Alloc allocator_type;
|
112
|
+
|
113
|
+
%traits_swigtype(_Tp);
|
114
|
+
|
115
|
+
%fragment(SWIG_Traits_frag(std::vector<_Tp*, _Alloc >), "header",
|
116
|
+
fragment=SWIG_Traits_frag(_Tp),
|
117
|
+
fragment="StdVectorTraits") {
|
118
|
+
namespace swig {
|
119
|
+
template <> struct traits<std::vector<_Tp*, _Alloc > > {
|
120
|
+
typedef value_category category;
|
121
|
+
static const char* type_name() {
|
122
|
+
return "std::vector<" #_Tp " *," #_Alloc " >";
|
123
|
+
}
|
124
|
+
};
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp*, _Alloc >);
|
129
|
+
|
130
|
+
#ifdef %swig_vector_methods_val
|
131
|
+
// Add swig/language extra methods
|
132
|
+
%swig_vector_methods_val(std::vector<_Tp*, _Alloc >);
|
133
|
+
#endif
|
134
|
+
|
135
|
+
%std_vector_methods_val(vector);
|
136
|
+
};
|
137
|
+
|
138
|
+
// ***
|
139
|
+
// const pointer specialization
|
140
|
+
// ***
|
141
|
+
template<class _Tp, class _Alloc >
|
142
|
+
class vector<_Tp const *, _Alloc > {
|
143
|
+
public:
|
144
|
+
typedef size_t size_type;
|
145
|
+
typedef ptrdiff_t difference_type;
|
146
|
+
typedef _Tp const * value_type;
|
147
|
+
typedef value_type* pointer;
|
148
|
+
typedef const value_type* const_pointer;
|
149
|
+
typedef value_type reference;
|
150
|
+
typedef value_type const_reference;
|
151
|
+
typedef _Alloc allocator_type;
|
152
|
+
|
153
|
+
%traits_swigtype(_Tp);
|
154
|
+
|
155
|
+
%fragment(SWIG_Traits_frag(std::vector<_Tp const*, _Alloc >), "header",
|
156
|
+
fragment=SWIG_Traits_frag(_Tp),
|
157
|
+
fragment="StdVectorTraits") {
|
158
|
+
namespace swig {
|
159
|
+
template <> struct traits<std::vector<_Tp const*, _Alloc > > {
|
160
|
+
typedef value_category category;
|
161
|
+
static const char* type_name() {
|
162
|
+
return "std::vector<" #_Tp " const*," #_Alloc " >";
|
163
|
+
}
|
164
|
+
};
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<_Tp const*, _Alloc >);
|
169
|
+
|
170
|
+
#ifdef %swig_vector_methods_val
|
171
|
+
// Add swig/language extra methods
|
172
|
+
%swig_vector_methods_val(std::vector<_Tp const*, _Alloc >);
|
173
|
+
#endif
|
174
|
+
|
175
|
+
%std_vector_methods_val(vector);
|
176
|
+
};
|
177
|
+
|
178
|
+
// ***
|
179
|
+
// bool specialization
|
180
|
+
// ***
|
181
|
+
|
182
|
+
template<class _Alloc >
|
183
|
+
class vector<bool,_Alloc > {
|
184
|
+
public:
|
185
|
+
typedef size_t size_type;
|
186
|
+
typedef ptrdiff_t difference_type;
|
187
|
+
typedef bool value_type;
|
188
|
+
typedef value_type* pointer;
|
189
|
+
typedef const value_type* const_pointer;
|
190
|
+
typedef value_type reference;
|
191
|
+
typedef value_type const_reference;
|
192
|
+
typedef _Alloc allocator_type;
|
193
|
+
|
194
|
+
%traits_swigtype(bool);
|
195
|
+
|
196
|
+
%fragment(SWIG_Traits_frag(std::vector<bool, _Alloc >), "header",
|
197
|
+
fragment=SWIG_Traits_frag(bool),
|
198
|
+
fragment="StdVectorTraits") {
|
199
|
+
namespace swig {
|
200
|
+
template <> struct traits<std::vector<bool, _Alloc > > {
|
201
|
+
typedef value_category category;
|
202
|
+
static const char* type_name() {
|
203
|
+
return "std::vector<bool, _Alloc >";
|
204
|
+
}
|
205
|
+
};
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
%typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<bool, _Alloc >);
|
210
|
+
|
211
|
+
|
212
|
+
#ifdef %swig_vector_methods_val
|
213
|
+
// Add swig/language extra methods
|
214
|
+
%swig_vector_methods_val(std::vector<bool, _Alloc >);
|
215
|
+
#endif
|
216
|
+
|
217
|
+
%std_vector_methods_val(vector);
|
218
|
+
|
219
|
+
#if defined(SWIG_STD_MODERN_STL) && !defined(SWIG_STD_NOMODERN_STL)
|
220
|
+
void flip();
|
221
|
+
#endif
|
222
|
+
|
223
|
+
};
|
224
|
+
|
225
|
+
}
|
@@ -1,119 +1,153 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
1
|
+
#!/usr/bin/env Rscript
|
2
|
+
### Example R script for syntax highlighting
|
3
|
+
|
4
|
+
# This is also a comment
|
5
|
+
|
6
|
+
## Valid names
|
7
|
+
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV0123456789._a <- NULL
|
8
|
+
.foo_ <- NULL
|
9
|
+
._foo <- NULL
|
10
|
+
|
11
|
+
## Invalid names
|
12
|
+
0abc <- NULL
|
13
|
+
.0abc <- NULL
|
14
|
+
abc+cde <- NULL
|
15
|
+
|
16
|
+
## Reserved Words
|
17
|
+
NA
|
18
|
+
NA_integer_
|
19
|
+
NA_real_
|
20
|
+
NA_character_
|
21
|
+
NA_complex_
|
22
|
+
NULL
|
23
|
+
NaN
|
24
|
+
Inf
|
25
|
+
## Not reserved
|
26
|
+
NULLa <- NULL
|
27
|
+
NULL1 <- NULL
|
28
|
+
NULL. <- NULL
|
29
|
+
NA_foo_ <- NULL
|
30
|
+
|
31
|
+
## Numbers
|
32
|
+
12345678901
|
33
|
+
123456.78901
|
34
|
+
123e3
|
35
|
+
123E3
|
36
|
+
1.23e-3
|
37
|
+
1.23e3
|
38
|
+
1.23e-3
|
39
|
+
## integer constants
|
40
|
+
123L
|
41
|
+
1.23L
|
42
|
+
## imaginary numbers
|
43
|
+
123i
|
44
|
+
-123i
|
45
|
+
123e4i
|
46
|
+
123e-4i
|
47
|
+
## Hex numbers
|
48
|
+
0xabcdefABCDEF01234
|
49
|
+
0xabcp123
|
50
|
+
0xabcP123
|
51
|
+
## Not hex
|
52
|
+
0xg
|
53
|
+
|
54
|
+
## Special operators %xyz%
|
55
|
+
## %xyz%
|
56
|
+
1 %% 2
|
57
|
+
diag(2) %*% diag(2)
|
58
|
+
1 %/% 2
|
59
|
+
1 %in% 1:10
|
60
|
+
diag(2) %o% diag(2)
|
61
|
+
diag(2) %x% diag(2)
|
62
|
+
`%foo bar%` <- function(x, y) x + y
|
63
|
+
1 %foo bar% 2
|
64
|
+
|
65
|
+
## Control Structures (3.2) and Function
|
66
|
+
## if, else
|
67
|
+
if (TRUE) print("foo") else print("bar")
|
68
|
+
## For, in
|
69
|
+
for(i in 1:5) {
|
70
|
+
print(i)
|
57
71
|
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
loglik <- 2*(sum(log(onepluslamh)) - sum((onepluslamh-1)/onepluslamh) )
|
64
|
-
#?is that right? YES see (3.2) in Ref. above. This ALR, or Poisson LR.
|
65
|
-
|
66
|
-
#last <- length(jump) ## to compute loglik2, we need to drop last jump
|
67
|
-
#if (jump[last] == 1) {
|
68
|
-
# risk1 <- risk[-last]
|
69
|
-
# jump1 <- jump[-last]
|
70
|
-
# weights1 <- weights[-last]
|
71
|
-
# } else {
|
72
|
-
# risk1 <- risk
|
73
|
-
# jump1 <- jump
|
74
|
-
# weights1 <- weights
|
75
|
-
# }
|
76
|
-
#loglik2 <- 2*( sum(log(onepluslamh)) +
|
77
|
-
# sum( (risk1 -1)*log((1-jump1)/(1- weights1) ) ) )
|
78
|
-
##? this likelihood seems have negative values sometimes???
|
79
|
-
|
80
|
-
list( logemlik=loglik, ### logemlikv2=loglik2,
|
81
|
-
lambda=lam, times=time, wts=weights,
|
82
|
-
nits=temp2$nf, message=temp2$message )
|
72
|
+
## While, break
|
73
|
+
i <- 1
|
74
|
+
while (TRUE) {
|
75
|
+
i <- i + 1
|
76
|
+
if (i > 3) break
|
83
77
|
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
y <- list(1,2,a=4,5)
|
106
|
-
y[c(3,4)] # a list containing elements 3 and 4 of y
|
107
|
-
y$a # the element of y named a
|
108
|
-
|
109
|
-
# from doc: for
|
110
|
-
for(n in c(2,5,10,20,50)) {
|
111
|
-
x <- stats::rnorm(n)
|
112
|
-
cat(n,":", sum(x2),"\n")
|
78
|
+
## Repeat
|
79
|
+
repeat {1+1}
|
80
|
+
## Switch
|
81
|
+
x <- 3
|
82
|
+
switch(x, 2+2, mean(1:10), rnorm(5))
|
83
|
+
## Function, dot-dot-dot, return
|
84
|
+
foo <- function(...) {
|
85
|
+
return(sum(...))
|
86
|
+
}
|
87
|
+
# Not keywords
|
88
|
+
functiona <- 2 + 2
|
89
|
+
function. <- 2 + 2
|
90
|
+
function1 <- 2 + 2
|
91
|
+
|
92
|
+
|
93
|
+
## Grouping Tokens 10.3.7
|
94
|
+
## Parentheses
|
95
|
+
1 + (2 + 3)
|
96
|
+
## brackets
|
97
|
+
foo <- function(a) {
|
98
|
+
a + 1
|
113
99
|
}
|
114
100
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
101
|
+
## Indexing 10.3.8
|
102
|
+
## []
|
103
|
+
bar <- 1:10
|
104
|
+
bar[3]
|
105
|
+
## [[]]
|
106
|
+
foo <- list(a=1, b=2, c=3)
|
107
|
+
foo[["a"]]
|
108
|
+
## $
|
109
|
+
foo$a
|
110
|
+
foo$"a"
|
111
|
+
|
112
|
+
## Operators
|
113
|
+
2 - 2
|
114
|
+
2 + 2
|
115
|
+
2 ~ 2
|
116
|
+
! TRUE
|
117
|
+
?"help"
|
118
|
+
1:2
|
119
|
+
2 * 2
|
120
|
+
2 / 2
|
121
|
+
2^2
|
122
|
+
2 < 2
|
123
|
+
2 > 2
|
124
|
+
2 == 2
|
125
|
+
2 >= 2
|
126
|
+
2 <= 2
|
127
|
+
2 != 2
|
128
|
+
TRUE & FALSE
|
129
|
+
TRUE && FALSE
|
130
|
+
TRUE | FALSE
|
131
|
+
TRUE || FALSE
|
132
|
+
foo <- 2 + 2
|
133
|
+
foo = 2 + 2
|
134
|
+
2 + 2 -> foo
|
135
|
+
foo <<- 2 + 2
|
136
|
+
2 + 2 ->> foo
|
137
|
+
base:::sum
|
138
|
+
base::sum
|
139
|
+
|
140
|
+
## Strings
|
141
|
+
foo <- "hello, world!"
|
142
|
+
foo <- 'hello, world!'
|
143
|
+
foo <- "Hello, 'world!"
|
144
|
+
foo <- 'Hello, "world!'
|
145
|
+
foo <- 'Hello, \'world!\''
|
146
|
+
foo <- "Hello, \"world!\""
|
147
|
+
foo <- "Hello,
|
148
|
+
world!"
|
149
|
+
foo <- 'Hello,
|
150
|
+
world!'
|
151
|
+
|
152
|
+
## Backtick strings
|
153
|
+
`foo123 +!"bar'baz` <- 2 + 2
|