on master help sign in
Merge branch 'master' into feature/dark_plus_theme
commitbfa9c3bef60d97238b6d9e1495b58b8a8c8151d8 authorDavid Peter <sharkdp@users.noreply.github.com> dateWed 12 May 2021, 22:28 (5 years ago) parentaa442b52904f24
18 files changed+1405−7
.gitmodules+4−5 CHANGELOG.md+1 assets/patches/Monokai-Extended.tmTheme.patch+18 assets/syntaxes/02_Extra/SublimeEthereum+1 assets/syntaxes/02_Extra/Syslog−1 assets/syntaxes/02_Extra/log.sublime-syntax+116 assets/syntaxes/02_Extra/syslog.sublime-syntax+63 src/less.rs+14−1 tests/syntax-tests/highlighted/Log/example.log+2 tests/syntax-tests/highlighted/Solidity/ERC721.sol+376 tests/syntax-tests/highlighted/Syslog/example.syslog+11 tests/syntax-tests/highlighted/Vyper/crowdsale.vy+89 tests/syntax-tests/source/Log/example.log+2 tests/syntax-tests/source/Solidity/ERC721.sol+376 tests/syntax-tests/source/Solidity/LICENSE.md+27 tests/syntax-tests/source/Syslog/example.syslog+11 tests/syntax-tests/source/Vyper/LICENSE.md+205 tests/syntax-tests/source/Vyper/crowdsale.vy+89
.gitmodules+4−5
@@ -94,10 +94,6 @@
9494[submodule "assets/syntaxes/Assembly (ARM)"]
9595 path = assets/syntaxes/02_Extra/Assembly (ARM)
9696 url = https://github.com/tvi/Sublime-ARM-Assembly
97−[submodule "assets/syntaxes/syslog-syntax"]
98− path = assets/syntaxes/02_Extra/Syslog
99− url = https://github.com/caos21/syslog-syntax.git
100− branch = master
10197[submodule "assets/syntaxes/protobuf-syntax-highlighting"]
10298 path = assets/syntaxes/02_Extra/Protobuf
10399 url = https://github.com/VcamX/protobuf-syntax-highlighting.git
@@ -218,4 +214,7 @@
218214 url = https://github.com/TheClams/SystemVerilog.git
219215[submodule "assets/themes/visual-studio-dark-plus"]
220216 path = assets/themes/visual-studio-dark-plus
221− url = https://github.com/vidann1/visual-studio-dark-plus.git
217+ url = https://github.com/vidann1/visual-studio-dark-plus.git
218+[submodule "assets/syntaxes/02_Extra/SublimeEthereum"]
219+ path = assets/syntaxes/02_Extra/SublimeEthereum
220+ url = https://github.com/davidhq/SublimeEthereum.git
CHANGELOG.md+1
@@ -13,6 +13,7 @@
1313
1414## Syntaxes
1515
16+- Improved the Syslog syntax highlighting, see #1606 (@keith-hall)
1617- Replaced "Advanced CSV" with a custom CSV syntax definition written especially for `bat`; see #1574 (@keith-hall)
1718
1819## New themes
assets/patches/Monokai-Extended.tmTheme.patch+18
@@ -16,3 +16,21 @@ index 9c2aa3e..180cbbf 100644
1616 </dict>
1717 </dict>
1818 <dict>
19+@@ -1027,7 +1027,7 @@
20+ <key>name</key>
21+ <string>Invalid</string>
22+ <key>scope</key>
23+- <string>invalid</string>
24++ <string>invalid, markup.error</string>
25+ <key>settings</key>
26+ <dict>
27+ <key>background</key>
28+@@ -1042,7 +1042,7 @@
29+ <key>name</key>
30+ <string>Invalid deprecated</string>
31+ <key>scope</key>
32+- <string>invalid.deprecated</string>
33++ <string>invalid.deprecated, markup.warning</string>
34+ <key>settings</key>
35+ <dict>
36+ <key>background</key>
assets/syntaxes/02_Extra/SublimeEthereumnew file+1

Submodule changed.

assets/syntaxes/02_Extra/Syslogdeleted−1

Submodule changed.

assets/syntaxes/02_Extra/log.sublime-syntaxnew file+116
@@ -0,0 +1,116 @@
1+%YAML 1.2
2+---
3+# See http://www.sublimetext.com/docs/3/syntax.html
4+file_extensions:
5+ - log
6+scope: text.log
7+variables:
8+ ipv4_part: (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
9+contexts:
10+ main:
11+ - match: (\w+)(=)
12+ captures:
13+ 1: variable.parameter.log
14+ 2: keyword.operator.assignment.log
15+ - match: (')([^']*)(')
16+ scope: string.quoted.single.log
17+ captures:
18+ 1: punctuation.definition.string.begin.log
19+ 3: punctuation.definition.string.end.log
20+ - match: (")([^"]*)(")
21+ scope: string.quoted.double.log
22+ captures:
23+ 1: punctuation.definition.string.begin.log
24+ 3: punctuation.definition.string.end.log
25+ - include: dates
26+ - include: ip_addresses
27+ - include: numbers
28+ - match: \b(?i:fail(?:ure|ed)?|error|exception)\b
29+ scope: markup.error.log
30+ - match: \b(?i:warn(?:ing)?)\b
31+ scope: markup.warning.log
32+ #- include: scope:text.html.markdown#autolink-inet
33+ - match: \b\w+:/{2,3}
34+ scope: markup.underline.link.scheme.log
35+ push: url-host
36+ dates:
37+ - match: \b\d{4}-\d{2}-\d{2}\b
38+ scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
39+ - match: \b\d{4}/\d{2}/\d{2}\b
40+ scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
41+ - match: \b(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)(?:(\.)\d{3})?\b
42+ scope: meta.time.log meta.number.integer.decimal.log constant.numeric.value.log
43+ captures:
44+ 1: punctuation.separator.decimal.log
45+ ip_addresses:
46+ - match: \b(?=(?:{{ipv4_part}}\.){3}{{ipv4_part}}\b)
47+ push:
48+ - meta_scope: meta.ipaddress.v4.log meta.number.integer.decimal.log
49+ - match: \d+
50+ scope: constant.numeric.value.log
51+ - match: \.
52+ scope: punctuation.separator.sequence.log
53+ - match: ''
54+ pop: true
55+ - match: (?=(?:\h{0,4}:){2,6}\h{1,4}\b)
56+ push:
57+ - meta_scope: meta.ipaddress.v6.log meta.number.integer.hexadecimal.log
58+ - match: \h{1,4}
59+ scope: constant.numeric.value.log
60+ - match: ':'
61+ scope: punctuation.separator.sequence.log
62+ - match: ''
63+ pop: true
64+ numbers:
65+ - match: \b(0x)(\h+)(?:(\.)(\h+))?\b
66+ scope: meta.number.float.hexadecimal.log
67+ captures:
68+ 1: constant.numeric.base.log
69+ 2: constant.numeric.value.log
70+ 3: constant.numeric.value.log punctuation.separator.decimal.log
71+ 4: constant.numeric.value.log
72+ - match: \b\d+(\.)\d+\b
73+ scope: meta.number.float.log constant.numeric.value.log
74+ captures:
75+ 1: punctuation.separator.decimal.log
76+ - match: \b\d+\b
77+ scope: meta.number.integer.log constant.numeric.value.log
78+ url-host:
79+ - meta_content_scope: markup.underline.link.host.log
80+ - match: \[
81+ scope: punctuation.section.brackets.begin.log
82+ push:
83+ - match: \]
84+ scope: punctuation.section.brackets.end.log
85+ pop: true
86+ - include: ip_addresses
87+ - match: '[^:/\s]+'
88+ - match: ''
89+ set: url-after-host
90+ url-after-host:
91+ - match: (:)(\d+)
92+ scope: markup.underline.link.port.log
93+ captures:
94+ 1: punctuation.separator.mapping.port.log
95+ 2: constant.numeric.value.log
96+ #- include: scope:text.html.markdown#url-escaped-chars
97+ - match: (%)\h{2}
98+ scope: markup.underline.link.path.log constant.character.escape.url.log
99+ captures:
100+ 1: punctuation.definition.escape.log
101+ # After a valid domain, zero or more non-space non-< characters may follow
102+ - match: (?=[?!.,:*_~]*[\s<]) # Trailing punctuation (specifically, ?, !, ., ,, :, *, _, and ~) will not be considered part of the autolink, though they may be included in the interior of the link
103+ pop: true
104+ - match: \( # When an autolink ends in ), we scan the entire autolink for the total number of parentheses. If there is a greater number of closing parentheses than opening ones, we don’t consider the last character part of the autolink, in order to facilitate including an autolink inside a parenthesis
105+ push:
106+ - meta_scope: markup.underline.link.path.log
107+ - match: (?=[?!.,:*_~]*[\s<])
108+ pop: true
109+ - match: \)
110+ pop: true
111+ - match: (?=\)[?!.,:*_~]*[\s<])
112+ pop: true
113+ - match: '[^?!.,:*_~\s<&()%]+|\S'
114+ scope: markup.underline.link.path.log
115+ - match: ''
116+ pop: true
assets/syntaxes/02_Extra/syslog.sublime-syntaxnew file+63
@@ -0,0 +1,63 @@
1+%YAML 1.2
2+---
3+# http://www.sublimetext.com/docs/3/syntax.html
4+name: syslog
5+file_extensions:
6+ - syslog
7+scope: text.log.syslog
8+contexts:
9+ main:
10+ - match: ^(\w+\s+\d+)\s+(\d{2}:\d{2}:\d{2})
11+ scope: meta.datetime.syslog constant.numeric.syslog
12+ captures:
13+ 1: meta.date.syslog
14+ 2: meta.time.syslog
15+ push: loghost
16+ - match: ^
17+ push: text
18+ loghost:
19+ - match: '[\w-]+'
20+ scope: entity.other.attribute-name.loghost.syslog
21+ set: process
22+ process:
23+ - match: ([\w-]+)(?:(\[)(\d+)(\]))?(:)
24+ captures:
25+ 1: support.function.process.syslog
26+ 2: punctuation.separator.pid.begin.syslog
27+ 3: meta.pid.syslog meta.number.integer.syslog constant.numeric.value.syslog
28+ 4: punctuation.separator.pid.end.syslog
29+ 5: punctuation.separator.mapping.syslog
30+ set: structured-data
31+ structured-data:
32+ - match: '\['
33+ scope: punctuation.section.mapping.begin.syslog
34+ push:
35+ - match: \]
36+ scope: punctuation.section.mapping.end.syslog
37+ pop: true
38+ - match: \w+
39+ scope: variable.parameter.syslog
40+ - match: =
41+ scope: keyword.operator.assignment.syslog
42+ push:
43+ - match: '[^\s\]]+'
44+ scope: constant.other.syslog
45+ pop: true
46+ - match: (?=\])
47+ pop: true
48+ - match: (?=\S)
49+ set: text
50+ text:
51+ - match: $
52+ pop: true
53+ - match: '<\w+>'
54+ scope: constant.language.syslog
55+ - match: \b(CMD)\b\s+(\()
56+ captures:
57+ 1: entity.name.label.syslog
58+ 2: punctuation.section.block.begin.syslog
59+ embed: scope:source.shell.bash
60+ escape: \)$
61+ escape_captures:
62+ 0: punctuation.section.block.end.syslog
63+ - include: scope:text.log
src/less.rs+14−1
@@ -11,7 +11,7 @@ pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<usize> {
1111fn parse_less_version(output: &[u8]) -> Option<usize> {
1212 if output.starts_with(b"less ") {
1313 let version = std::str::from_utf8(&output[5..]).ok()?;
14− let end = version.find(' ')?;
14+ let end = version.find(|c: char| !c.is_ascii_digit())?;
1515 version[..end].parse::<usize>().ok()
1616 } else {
1717 None
@@ -57,6 +57,19 @@ Home page: http://www.greenwoodsoftware.com/less";
5757 assert_eq!(Some(551), parse_less_version(output));
5858}
5959
60+#[test]
61+fn test_parse_less_version_581_2() {
62+ let output = b"less 581.2 (PCRE2 regular expressions)
63+Copyright (C) 1984-2021 Mark Nudelman
64+
65+less comes with NO WARRANTY, to the extent permitted by law.
66+For information about the terms of redistribution,
67+see the file named README in the less distribution.
68+Home page: https://greenwoodsoftware.com/less";
69+
70+ assert_eq!(Some(581), parse_less_version(output));
71+}
72+
6073#[test]
6174fn test_parse_less_version_wrong_program() {
6275 let output = b"more from util-linux 2.34";
tests/syntax-tests/highlighted/Log/example.lognew file+2
@@ -0,0 +1,2 @@
1+2021-03-06 23:22:21.392 https://[2001:db8:4006:812::200e]:8080/path/the%20page.html
2+2021-03-06 23:22:21 https://example.com:8080/path/the%20page(with_parens).html
tests/syntax-tests/highlighted/Solidity/ERC721.solnew file+376
@@ -0,0 +1,376 @@
1+// SPDX-License-Identifier: MIT
2+
3+pragma solidity ^0.8.0;
4+
5+import "./IERC721.sol";
6+import "./IERC721Receiver.sol";
7+import "./extensions/IERC721Metadata.sol";
8+import "../../utils/Address.sol";
9+import "../../utils/Context.sol";
10+import "../../utils/Strings.sol";
11+import "../../utils/introspection/ERC165.sol";
12+
13+/**
14+ * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
15+ * the Metadata extension, but not including the Enumerable extension, which is available separately as
16+ * {ERC721Enumerable}.
17+ */
18+contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
19+ using Address for address;
20+ using Strings for uint256;
21+
22+ // Token name
23+ string private _name;
24+
25+ // Token symbol
26+ string private _symbol;
27+
28+ // Mapping from token ID to owner address
29+ mapping (uint256 => address) private _owners;
30+
31+ // Mapping owner address to token count
32+ mapping (address => uint256) private _balances;
33+
34+ // Mapping from token ID to approved address
35+ mapping (uint256 => address) private _tokenApprovals;
36+
37+ // Mapping from owner to operator approvals
38+ mapping (address => mapping (address => bool)) private _operatorApprovals;
39+
40+ /**
41+ * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
42+ */
43+ constructor (string memory name_, string memory symbol_) {
44+ _name = name_;
45+ _symbol = symbol_;
46+ }
47+
48+ /**
49+ * @dev See {IERC165-supportsInterface}.
50+ */
51+ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
52+ return interfaceId == type(IERC721).interfaceId
53+ || interfaceId == type(IERC721Metadata).interfaceId
54+ || super.supportsInterface(interfaceId);
55+ }
56+
57+ /**
58+ * @dev See {IERC721-balanceOf}.
59+ */
60+ function balanceOf(address owner) public view virtual override returns (uint256) {
61+ require(owner != address(0), "ERC721: balance query for the zero address");
62+ return _balances[owner];
63+ }
64+
65+ /**
66+ * @dev See {IERC721-ownerOf}.
67+ */
68+ function ownerOf(uint256 tokenId) public view virtual override returns (address) {
69+ address owner = _owners[tokenId];
70+ require(owner != address(0), "ERC721: owner query for nonexistent token");
71+ return owner;
72+ }
73+
74+ /**
75+ * @dev See {IERC721Metadata-name}.
76+ */
77+ function name() public view virtual override returns (string memory) {
78+ return _name;
79+ }
80+
81+ /**
82+ * @dev See {IERC721Metadata-symbol}.
83+ */
84+ function symbol() public view virtual override returns (string memory) {
85+ return _symbol;
86+ }
87+
88+ /**
89+ * @dev See {IERC721Metadata-tokenURI}.
90+ */
91+ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
92+ require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
93+
94+ string memory baseURI = _baseURI();
95+ return bytes(baseURI).length > 0
96+ ? string(abi.encodePacked(baseURI, tokenId.toString()))
97+ : '';
98+ }
99+
100+ /**
101+ * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
102+ * in child contracts.
103+ */
104+ function _baseURI() internal view virtual returns (string memory) {
105+ return "";
106+ }
107+
108+ /**
109+ * @dev See {IERC721-approve}.
110+ */
111+ function approve(address to, uint256 tokenId) public virtual override {
112+ address owner = ERC721.ownerOf(tokenId);
113+ require(to != owner, "ERC721: approval to current owner");
114+
115+ require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
116+ "ERC721: approve caller is not owner nor approved for all"
117+ );
118+
119+ _approve(to, tokenId);
120+ }
121+
122+ /**
123+ * @dev See {IERC721-getApproved}.
124+ */
125+ function getApproved(uint256 tokenId) public view virtual override returns (address) {
126+ require(_exists(tokenId), "ERC721: approved query for nonexistent token");
127+
128+ return _tokenApprovals[tokenId];
129+ }
130+
131+ /**
132+ * @dev See {IERC721-setApprovalForAll}.
133+ */
134+ function setApprovalForAll(address operator, bool approved) public virtual override {
135+ require(operator != _msgSender(), "ERC721: approve to caller");
136+
137+ _operatorApprovals[_msgSender()][operator] = approved;
138+ emit ApprovalForAll(_msgSender(), operator, approved);
139+ }
140+
141+ /**
142+ * @dev See {IERC721-isApprovedForAll}.
143+ */
144+ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
145+ return _operatorApprovals[owner][operator];
146+ }
147+
148+ /**
149+ * @dev See {IERC721-transferFrom}.
150+ */
151+ function transferFrom(address from, address to, uint256 tokenId) public virtual override {
152+ //solhint-disable-next-line max-line-length
153+ require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
154+
155+ _transfer(from, to, tokenId);
156+ }
157+
158+ /**
159+ * @dev See {IERC721-safeTransferFrom}.
160+ */
161+ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
162+ safeTransferFrom(from, to, tokenId, "");
163+ }
164+
165+ /**
166+ * @dev See {IERC721-safeTransferFrom}.
167+ */
168+ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
169+ require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
170+ _safeTransfer(from, to, tokenId, _data);
171+ }
172+
173+ /**
174+ * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
175+ * are aware of the ERC721 protocol to prevent tokens from being forever locked.
176+ *
177+ * `_data` is additional data, it has no specified format and it is sent in call to `to`.
178+ *
179+ * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
180+ * implement alternative mechanisms to perform token transfer, such as signature-based.
181+ *
182+ * Requirements:
183+ *
184+ * - `from` cannot be the zero address.
185+ * - `to` cannot be the zero address.
186+ * - `tokenId` token must exist and be owned by `from`.
187+ * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
188+ *
189+ * Emits a {Transfer} event.
190+ */
191+ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
192+ _transfer(from, to, tokenId);
193+ require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
194+ }
195+
196+ /**
197+ * @dev Returns whether `tokenId` exists.
198+ *
199+ * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
200+ *
201+ * Tokens start existing when they are minted (`_mint`),
202+ * and stop existing when they are burned (`_burn`).
203+ */
204+ function _exists(uint256 tokenId) internal view virtual returns (bool) {
205+ return _owners[tokenId] != address(0);
206+ }
207+
208+ /**
209+ * @dev Returns whether `spender` is allowed to manage `tokenId`.
210+ *
211+ * Requirements:
212+ *
213+ * - `tokenId` must exist.
214+ */
215+ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
216+ require(_exists(tokenId), "ERC721: operator query for nonexistent token");
217+ address owner = ERC721.ownerOf(tokenId);
218+ return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
219+ }
220+
221+ /**
222+ * @dev Safely mints `tokenId` and transfers it to `to`.
223+ *
224+ * Requirements:
225+ *
226+ * - `tokenId` must not exist.
227+ * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
228+ *
229+ * Emits a {Transfer} event.
230+ */
231+ function _safeMint(address to, uint256 tokenId) internal virtual {
232+ _safeMint(to, tokenId, "");
233+ }
234+
235+ /**
236+ * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
237+ * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
238+ */
239+ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
240+ _mint(to, tokenId);
241+ require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
242+ }
243+
244+ /**
245+ * @dev Mints `tokenId` and transfers it to `to`.
246+ *
247+ * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
248+ *
249+ * Requirements:
250+ *
251+ * - `tokenId` must not exist.
252+ * - `to` cannot be the zero address.
253+ *
254+ * Emits a {Transfer} event.
255+ */
256+ function _mint(address to, uint256 tokenId) internal virtual {
257+ require(to != address(0), "ERC721: mint to the zero address");
258+ require(!_exists(tokenId), "ERC721: token already minted");
259+
260+ _beforeTokenTransfer(address(0), to, tokenId);
261+
262+ _balances[to] += 1;
263+ _owners[tokenId] = to;
264+
265+ emit Transfer(address(0), to, tokenId);
266+ }
267+
268+ /**
269+ * @dev Destroys `tokenId`.
270+ * The approval is cleared when the token is burned.
271+ *
272+ * Requirements:
273+ *
274+ * - `tokenId` must exist.
275+ *
276+ * Emits a {Transfer} event.
277+ */
278+ function _burn(uint256 tokenId) internal virtual {
279+ address owner = ERC721.ownerOf(tokenId);
280+
281+ _beforeTokenTransfer(owner, address(0), tokenId);
282+
283+ // Clear approvals
284+ _approve(address(0), tokenId);
285+
286+ _balances[owner] -= 1;
287+ delete _owners[tokenId];
288+
289+ emit Transfer(owner, address(0), tokenId);
290+ }
291+
292+ /**
293+ * @dev Transfers `tokenId` from `from` to `to`.
294+ * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
295+ *
296+ * Requirements:
297+ *
298+ * - `to` cannot be the zero address.
299+ * - `tokenId` token must be owned by `from`.
300+ *
301+ * Emits a {Transfer} event.
302+ */
303+ function _transfer(address from, address to, uint256 tokenId) internal virtual {
304+ require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
305+ require(to != address(0), "ERC721: transfer to the zero address");
306+
307+ _beforeTokenTransfer(from, to, tokenId);
308+
309+ // Clear approvals from the previous owner
310+ _approve(address(0), tokenId);
311+
312+ _balances[from] -= 1;
313+ _balances[to] += 1;
314+ _owners[tokenId] = to;
315+
316+ emit Transfer(from, to, tokenId);
317+ }
318+
319+ /**
320+ * @dev Approve `to` to operate on `tokenId`
321+ *
322+ * Emits a {Approval} event.
323+ */
324+ function _approve(address to, uint256 tokenId) internal virtual {
325+ _tokenApprovals[tokenId] = to;
326+ emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
327+ }
328+
329+ /**
330+ * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
331+ * The call is not executed if the target address is not a contract.
332+ *
333+ * @param from address representing the previous owner of the given token ID
334+ * @param to target address that will receive the tokens
335+ * @param tokenId uint256 ID of the token to be transferred
336+ * @param _data bytes optional data to send along with the call
337+ * @return bool whether the call correctly returned the expected magic value
338+ */
339+ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
340+ private returns (bool)
341+ {
342+ if (to.isContract()) {
343+ try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
344+ return retval == IERC721Receiver(to).onERC721Received.selector;
345+ } catch (bytes memory reason) {
346+ if (reason.length == 0) {
347+ revert("ERC721: transfer to non ERC721Receiver implementer");
348+ } else {
349+ // solhint-disable-next-line no-inline-assembly
350+ assembly {
351+ revert(add(32, reason), mload(reason))
352+ }
353+ }
354+ }
355+ } else {
356+ return true;
357+ }
358+ }
359+
360+ /**
361+ * @dev Hook that is called before any token transfer. This includes minting
362+ * and burning.
363+ *
364+ * Calling conditions:
365+ *
366+ * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
367+ * transferred to `to`.
368+ * - When `from` is zero, `tokenId` will be minted for `to`.
369+ * - When `to` is zero, ``from``'s `tokenId` will be burned.
370+ * - `from` cannot be the zero address.
371+ * - `to` cannot be the zero address.
372+ *
373+ * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
374+ */
375+ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
376+}
tests/syntax-tests/highlighted/Syslog/example.syslognew file+11
@@ -0,0 +1,11 @@
1+Apr 4 00:00:01 hostname-here systemd[1]: logrotate.service: Succeeded.
2+Apr 4 00:00:01 hostname-here systemd[1]: Finished Rotate log files.
3+Apr 4 00:00:01 hostname-here colord[920]: failed to get session [pid 137485]: No data available
4+Apr 4 00:00:21 hostname-here kernel: [55604.908232] audit: type=1400 audit(1617483621.094:28): apparmor="DENIED" operation="capable" profile="/usr/sbin/cups-browsed" pid=59311 comm="cups-browsed" capability=23 capname="sys_nice"
5+Apr 4 00:01:38 hostname-here systemd-resolved[721]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
6+Apr 4 00:04:46 hostname-here ntpd[952]: Soliciting pool server 255.76.59.37
7+Apr 4 00:05:21 hostname-here ntpd[952]: ::1 local addr 0:0:0:0:0:0:0:1 -> <null>
8+Apr 4 00:06:29 hostname-here ntpd[952]: receive: Unexpected origin timestamp 0xe414a8d1.82e825f5 does not match aorg 0xe414a8d5.82c50d8c from server@127.0.0.1 xmt 0xe414a8d1.e671d7c4
9+Apr 4 09:30:01 hostname-here CRON[89278]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
10+Apr 4 16:32:07 hostname-here NetworkManager[740]: <info> [1617629527.1101] manager: NetworkManager state is now CONNECTED_GLOBAL
11+Apr 4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Successfully activated service 'io.github.celluloid_player.Celluloid'
tests/syntax-tests/highlighted/Vyper/crowdsale.vynew file+89
@@ -0,0 +1,89 @@
1+# IndividuallyCappedCrowdsale
2+# Contributors: Binod Nirvan
3+# This file is released under Apache 2.0 license.
4+# @dev Crowdsale with a limit for total contributions.
5+# Ported from Open Zeppelin
6+# https://github.com/OpenZeppelin
7+# 
8+# See https://github.com/OpenZeppelin
9+# Open Zeppelin tests ported: Crowdsale.test.js
10+
11+
12+#@dev ERC20/223 Features referenced by this contract
13+contract TokenContract:
14+ def transfer(_to: address, _value: uint256) -> bool: modifying
15+
16+# Event for token purchase logging
17+# @param _purchaser who paid for the tokens
18+# @param _beneficiary who got the tokens
19+# @param _value weis paid for purchase
20+# @param _amount amount of tokens purchased
21+TokenPurchase: event({_purchaser: indexed(address), _beneficiary: indexed(address), _value: uint256(wei), _amount: uint256})
22+
23+# The token being sold
24+token: public(address)
25+
26+#Address where funds are collected
27+wallet: public(address)
28+
29+# How many token units a buyer gets per wei.
30+# The rate is the conversion between wei and the smallest and indivisible token unit.
31+# So, if you are using a rate of 1 with a DetailedERC20 token with 3 decimals called TOK
32+# 1 wei will give you 1 unit, or 0.001 TOK.
33+rate: public(uint256)
34+
35+#Amount of wei raised
36+weiRaised: public(uint256(wei))
37+
38+@public
39+def __init__(_rate: uint256, _wallet: address, _token: address):
40+ """
41+ @dev Initializes this contract
42+ @param _rate Number of token units a buyer gets per wei
43+ @param _wallet Address where collected funds will be forwarded to
44+ @param _token Address of the token being sold
45+ """
46+
47+ assert _rate > 0, "Invalid value supplied for the parameter \"_rate\"."
48+ assert _wallet != ZERO_ADDRESS, "Invalid wallet address."
49+ assert _token != ZERO_ADDRESS, "Invalid token address."
50+
51+ self.rate = _rate
52+ self.wallet = _wallet
53+ self.token = _token
54+
55+@private
56+@constant
57+def getTokenAmount(_weiAmount: uint256) -> uint256:
58+ return _weiAmount * self.rate
59+
60+
61+@private
62+def processTransaction(_sender: address, _beneficiary: address, _weiAmount: uint256(wei)):
63+ #pre validate
64+ assert _beneficiary != ZERO_ADDRESS, "Invalid address."
65+ assert _weiAmount != 0, "Invalid amount received."
66+
67+ #calculate the number of tokens for the Ether contribution.
68+ tokens: uint256 = self.getTokenAmount(as_unitless_number(_weiAmount))
69+ 
70+ self.weiRaised += _weiAmount
71+
72+ #process purchase
73+ assert TokenContract(self.token).transfer(_beneficiary, tokens), "Could not forward funds due to an unknown error."
74+ log.TokenPurchase(_sender, _beneficiary, _weiAmount, tokens)
75+
76+ #forward funds to the receiving wallet address.
77+ send(self.wallet, _weiAmount)
78+
79+ #post validate
80+
81+@public
82+@payable
83+def buyTokens(_beneficiary: address):
84+ self.processTransaction(msg.sender, _beneficiary, msg.value)
85+
86+@public
87+@payable
88+def __default__():
89+ self.processTransaction(msg.sender, msg.sender, msg.value)
tests/syntax-tests/source/Log/example.lognew file+2
@@ -0,0 +1,2 @@
1+2021-03-06 23:22:21.392 https://[2001:db8:4006:812::200e]:8080/path/the%20page.html
2+2021-03-06 23:22:21 https://example.com:8080/path/the%20page(with_parens).html
tests/syntax-tests/source/Solidity/ERC721.solnew file+376
@@ -0,0 +1,376 @@
1+// SPDX-License-Identifier: MIT
2+
3+pragma solidity ^0.8.0;
4+
5+import "./IERC721.sol";
6+import "./IERC721Receiver.sol";
7+import "./extensions/IERC721Metadata.sol";
8+import "../../utils/Address.sol";
9+import "../../utils/Context.sol";
10+import "../../utils/Strings.sol";
11+import "../../utils/introspection/ERC165.sol";
12+
13+/**
14+ * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
15+ * the Metadata extension, but not including the Enumerable extension, which is available separately as
16+ * {ERC721Enumerable}.
17+ */
18+contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
19+ using Address for address;
20+ using Strings for uint256;
21+
22+ // Token name
23+ string private _name;
24+
25+ // Token symbol
26+ string private _symbol;
27+
28+ // Mapping from token ID to owner address
29+ mapping (uint256 => address) private _owners;
30+
31+ // Mapping owner address to token count
32+ mapping (address => uint256) private _balances;
33+
34+ // Mapping from token ID to approved address
35+ mapping (uint256 => address) private _tokenApprovals;
36+
37+ // Mapping from owner to operator approvals
38+ mapping (address => mapping (address => bool)) private _operatorApprovals;
39+
40+ /**
41+ * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
42+ */
43+ constructor (string memory name_, string memory symbol_) {
44+ _name = name_;
45+ _symbol = symbol_;
46+ }
47+
48+ /**
49+ * @dev See {IERC165-supportsInterface}.
50+ */
51+ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
52+ return interfaceId == type(IERC721).interfaceId
53+ || interfaceId == type(IERC721Metadata).interfaceId
54+ || super.supportsInterface(interfaceId);
55+ }
56+
57+ /**
58+ * @dev See {IERC721-balanceOf}.
59+ */
60+ function balanceOf(address owner) public view virtual override returns (uint256) {
61+ require(owner != address(0), "ERC721: balance query for the zero address");
62+ return _balances[owner];
63+ }
64+
65+ /**
66+ * @dev See {IERC721-ownerOf}.
67+ */
68+ function ownerOf(uint256 tokenId) public view virtual override returns (address) {
69+ address owner = _owners[tokenId];
70+ require(owner != address(0), "ERC721: owner query for nonexistent token");
71+ return owner;
72+ }
73+
74+ /**
75+ * @dev See {IERC721Metadata-name}.
76+ */
77+ function name() public view virtual override returns (string memory) {
78+ return _name;
79+ }
80+
81+ /**
82+ * @dev See {IERC721Metadata-symbol}.
83+ */
84+ function symbol() public view virtual override returns (string memory) {
85+ return _symbol;
86+ }
87+
88+ /**
89+ * @dev See {IERC721Metadata-tokenURI}.
90+ */
91+ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
92+ require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");
93+
94+ string memory baseURI = _baseURI();
95+ return bytes(baseURI).length > 0
96+ ? string(abi.encodePacked(baseURI, tokenId.toString()))
97+ : '';
98+ }
99+
100+ /**
101+ * @dev Base URI for computing {tokenURI}. Empty by default, can be overriden
102+ * in child contracts.
103+ */
104+ function _baseURI() internal view virtual returns (string memory) {
105+ return "";
106+ }
107+
108+ /**
109+ * @dev See {IERC721-approve}.
110+ */
111+ function approve(address to, uint256 tokenId) public virtual override {
112+ address owner = ERC721.ownerOf(tokenId);
113+ require(to != owner, "ERC721: approval to current owner");
114+
115+ require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
116+ "ERC721: approve caller is not owner nor approved for all"
117+ );
118+
119+ _approve(to, tokenId);
120+ }
121+
122+ /**
123+ * @dev See {IERC721-getApproved}.
124+ */
125+ function getApproved(uint256 tokenId) public view virtual override returns (address) {
126+ require(_exists(tokenId), "ERC721: approved query for nonexistent token");
127+
128+ return _tokenApprovals[tokenId];
129+ }
130+
131+ /**
132+ * @dev See {IERC721-setApprovalForAll}.
133+ */
134+ function setApprovalForAll(address operator, bool approved) public virtual override {
135+ require(operator != _msgSender(), "ERC721: approve to caller");
136+
137+ _operatorApprovals[_msgSender()][operator] = approved;
138+ emit ApprovalForAll(_msgSender(), operator, approved);
139+ }
140+
141+ /**
142+ * @dev See {IERC721-isApprovedForAll}.
143+ */
144+ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
145+ return _operatorApprovals[owner][operator];
146+ }
147+
148+ /**
149+ * @dev See {IERC721-transferFrom}.
150+ */
151+ function transferFrom(address from, address to, uint256 tokenId) public virtual override {
152+ //solhint-disable-next-line max-line-length
153+ require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
154+
155+ _transfer(from, to, tokenId);
156+ }
157+
158+ /**
159+ * @dev See {IERC721-safeTransferFrom}.
160+ */
161+ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
162+ safeTransferFrom(from, to, tokenId, "");
163+ }
164+
165+ /**
166+ * @dev See {IERC721-safeTransferFrom}.
167+ */
168+ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
169+ require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
170+ _safeTransfer(from, to, tokenId, _data);
171+ }
172+
173+ /**
174+ * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
175+ * are aware of the ERC721 protocol to prevent tokens from being forever locked.
176+ *
177+ * `_data` is additional data, it has no specified format and it is sent in call to `to`.
178+ *
179+ * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
180+ * implement alternative mechanisms to perform token transfer, such as signature-based.
181+ *
182+ * Requirements:
183+ *
184+ * - `from` cannot be the zero address.
185+ * - `to` cannot be the zero address.
186+ * - `tokenId` token must exist and be owned by `from`.
187+ * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
188+ *
189+ * Emits a {Transfer} event.
190+ */
191+ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
192+ _transfer(from, to, tokenId);
193+ require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
194+ }
195+
196+ /**
197+ * @dev Returns whether `tokenId` exists.
198+ *
199+ * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
200+ *
201+ * Tokens start existing when they are minted (`_mint`),
202+ * and stop existing when they are burned (`_burn`).
203+ */
204+ function _exists(uint256 tokenId) internal view virtual returns (bool) {
205+ return _owners[tokenId] != address(0);
206+ }
207+
208+ /**
209+ * @dev Returns whether `spender` is allowed to manage `tokenId`.
210+ *
211+ * Requirements:
212+ *
213+ * - `tokenId` must exist.
214+ */
215+ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
216+ require(_exists(tokenId), "ERC721: operator query for nonexistent token");
217+ address owner = ERC721.ownerOf(tokenId);
218+ return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
219+ }
220+
221+ /**
222+ * @dev Safely mints `tokenId` and transfers it to `to`.
223+ *
224+ * Requirements:
225+ *
226+ * - `tokenId` must not exist.
227+ * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
228+ *
229+ * Emits a {Transfer} event.
230+ */
231+ function _safeMint(address to, uint256 tokenId) internal virtual {
232+ _safeMint(to, tokenId, "");
233+ }
234+
235+ /**
236+ * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
237+ * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
238+ */
239+ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
240+ _mint(to, tokenId);
241+ require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
242+ }
243+
244+ /**
245+ * @dev Mints `tokenId` and transfers it to `to`.
246+ *
247+ * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
248+ *
249+ * Requirements:
250+ *
251+ * - `tokenId` must not exist.
252+ * - `to` cannot be the zero address.
253+ *
254+ * Emits a {Transfer} event.
255+ */
256+ function _mint(address to, uint256 tokenId) internal virtual {
257+ require(to != address(0), "ERC721: mint to the zero address");
258+ require(!_exists(tokenId), "ERC721: token already minted");
259+
260+ _beforeTokenTransfer(address(0), to, tokenId);
261+
262+ _balances[to] += 1;
263+ _owners[tokenId] = to;
264+
265+ emit Transfer(address(0), to, tokenId);
266+ }
267+
268+ /**
269+ * @dev Destroys `tokenId`.
270+ * The approval is cleared when the token is burned.
271+ *
272+ * Requirements:
273+ *
274+ * - `tokenId` must exist.
275+ *
276+ * Emits a {Transfer} event.
277+ */
278+ function _burn(uint256 tokenId) internal virtual {
279+ address owner = ERC721.ownerOf(tokenId);
280+
281+ _beforeTokenTransfer(owner, address(0), tokenId);
282+
283+ // Clear approvals
284+ _approve(address(0), tokenId);
285+
286+ _balances[owner] -= 1;
287+ delete _owners[tokenId];
288+
289+ emit Transfer(owner, address(0), tokenId);
290+ }
291+
292+ /**
293+ * @dev Transfers `tokenId` from `from` to `to`.
294+ * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
295+ *
296+ * Requirements:
297+ *
298+ * - `to` cannot be the zero address.
299+ * - `tokenId` token must be owned by `from`.
300+ *
301+ * Emits a {Transfer} event.
302+ */
303+ function _transfer(address from, address to, uint256 tokenId) internal virtual {
304+ require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
305+ require(to != address(0), "ERC721: transfer to the zero address");
306+
307+ _beforeTokenTransfer(from, to, tokenId);
308+
309+ // Clear approvals from the previous owner
310+ _approve(address(0), tokenId);
311+
312+ _balances[from] -= 1;
313+ _balances[to] += 1;
314+ _owners[tokenId] = to;
315+
316+ emit Transfer(from, to, tokenId);
317+ }
318+
319+ /**
320+ * @dev Approve `to` to operate on `tokenId`
321+ *
322+ * Emits a {Approval} event.
323+ */
324+ function _approve(address to, uint256 tokenId) internal virtual {
325+ _tokenApprovals[tokenId] = to;
326+ emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
327+ }
328+
329+ /**
330+ * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
331+ * The call is not executed if the target address is not a contract.
332+ *
333+ * @param from address representing the previous owner of the given token ID
334+ * @param to target address that will receive the tokens
335+ * @param tokenId uint256 ID of the token to be transferred
336+ * @param _data bytes optional data to send along with the call
337+ * @return bool whether the call correctly returned the expected magic value
338+ */
339+ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
340+ private returns (bool)
341+ {
342+ if (to.isContract()) {
343+ try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
344+ return retval == IERC721Receiver(to).onERC721Received.selector;
345+ } catch (bytes memory reason) {
346+ if (reason.length == 0) {
347+ revert("ERC721: transfer to non ERC721Receiver implementer");
348+ } else {
349+ // solhint-disable-next-line no-inline-assembly
350+ assembly {
351+ revert(add(32, reason), mload(reason))
352+ }
353+ }
354+ }
355+ } else {
356+ return true;
357+ }
358+ }
359+
360+ /**
361+ * @dev Hook that is called before any token transfer. This includes minting
362+ * and burning.
363+ *
364+ * Calling conditions:
365+ *
366+ * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
367+ * transferred to `to`.
368+ * - When `from` is zero, `tokenId` will be minted for `to`.
369+ * - When `to` is zero, ``from``'s `tokenId` will be burned.
370+ * - `from` cannot be the zero address.
371+ * - `to` cannot be the zero address.
372+ *
373+ * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
374+ */
375+ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
376+}
tests/syntax-tests/source/Solidity/LICENSE.mdnew file+27
@@ -0,0 +1,27 @@
1+The `ERC721.sol` file has been added from
2+[](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol)
3+under the following license:
4+
5+The MIT License (MIT)
6+
7+Copyright (c) 2016-2020 zOS Global Limited
8+
9+Permission is hereby granted, free of charge, to any person obtaining
10+a copy of this software and associated documentation files (the
11+"Software"), to deal in the Software without restriction, including
12+without limitation the rights to use, copy, modify, merge, publish,
13+distribute, sublicense, and/or sell copies of the Software, and to
14+permit persons to whom the Software is furnished to do so, subject to
15+the following conditions:
16+
17+The above copyright notice and this permission notice shall be included
18+in all copies or substantial portions of the Software.
19+
20+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27+
tests/syntax-tests/source/Syslog/example.syslognew file+11
@@ -0,0 +1,11 @@
1+Apr 4 00:00:01 hostname-here systemd[1]: logrotate.service: Succeeded.
2+Apr 4 00:00:01 hostname-here systemd[1]: Finished Rotate log files.
3+Apr 4 00:00:01 hostname-here colord[920]: failed to get session [pid 137485]: No data available
4+Apr 4 00:00:21 hostname-here kernel: [55604.908232] audit: type=1400 audit(1617483621.094:28): apparmor="DENIED" operation="capable" profile="/usr/sbin/cups-browsed" pid=59311 comm="cups-browsed" capability=23 capname="sys_nice"
5+Apr 4 00:01:38 hostname-here systemd-resolved[721]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
6+Apr 4 00:04:46 hostname-here ntpd[952]: Soliciting pool server 255.76.59.37
7+Apr 4 00:05:21 hostname-here ntpd[952]: ::1 local addr 0:0:0:0:0:0:0:1 -> <null>
8+Apr 4 00:06:29 hostname-here ntpd[952]: receive: Unexpected origin timestamp 0xe414a8d1.82e825f5 does not match aorg 0xe414a8d5.82c50d8c from server@127.0.0.1 xmt 0xe414a8d1.e671d7c4
9+Apr 4 09:30:01 hostname-here CRON[89278]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
10+Apr 4 16:32:07 hostname-here NetworkManager[740]: <info> [1617629527.1101] manager: NetworkManager state is now CONNECTED_GLOBAL
11+Apr 4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Successfully activated service 'io.github.celluloid_player.Celluloid'
tests/syntax-tests/source/Vyper/LICENSE.mdnew file+205
@@ -0,0 +1,205 @@
1+The `crowdsale.vy` file has been added from
2+[](https://github.com/binodnp/vyper-crowdsale/blob/master/contracts/crowdsale.v.py)
3+under the following license:
4+
5+ Apache License
6+ Version 2.0, January 2004
7+ http://www.apache.org/licenses/
8+
9+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10+
11+ 1. Definitions.
12+
13+ "License" shall mean the terms and conditions for use, reproduction,
14+ and distribution as defined by Sections 1 through 9 of this document.
15+
16+ "Licensor" shall mean the copyright owner or entity authorized by
17+ the copyright owner that is granting the License.
18+
19+ "Legal Entity" shall mean the union of the acting entity and all
20+ other entities that control, are controlled by, or are under common
21+ control with that entity. For the purposes of this definition,
22+ "control" means (i) the power, direct or indirect, to cause the
23+ direction or management of such entity, whether by contract or
24+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
25+ outstanding shares, or (iii) beneficial ownership of such entity.
26+
27+ "You" (or "Your") shall mean an individual or Legal Entity
28+ exercising permissions granted by this License.
29+
30+ "Source" form shall mean the preferred form for making modifications,
31+ including but not limited to software source code, documentation
32+ source, and configuration files.
33+
34+ "Object" form shall mean any form resulting from mechanical
35+ transformation or translation of a Source form, including but
36+ not limited to compiled object code, generated documentation,
37+ and conversions to other media types.
38+
39+ "Work" shall mean the work of authorship, whether in Source or
40+ Object form, made available under the License, as indicated by a
41+ copyright notice that is included in or attached to the work
42+ (an example is provided in the Appendix below).
43+
44+ "Derivative Works" shall mean any work, whether in Source or Object
45+ form, that is based on (or derived from) the Work and for which the
46+ editorial revisions, annotations, elaborations, or other modifications
47+ represent, as a whole, an original work of authorship. For the purposes
48+ of this License, Derivative Works shall not include works that remain
49+ separable from, or merely link (or bind by name) to the interfaces of,
50+ the Work and Derivative Works thereof.
51+
52+ "Contribution" shall mean any work of authorship, including
53+ the original version of the Work and any modifications or additions
54+ to that Work or Derivative Works thereof, that is intentionally
55+ submitted to Licensor for inclusion in the Work by the copyright owner
56+ or by an individual or Legal Entity authorized to submit on behalf of
57+ the copyright owner. For the purposes of this definition, "submitted"
58+ means any form of electronic, verbal, or written communication sent
59+ to the Licensor or its representatives, including but not limited to
60+ communication on electronic mailing lists, source code control systems,
61+ and issue tracking systems that are managed by, or on behalf of, the
62+ Licensor for the purpose of discussing and improving the Work, but
63+ excluding communication that is conspicuously marked or otherwise
64+ designated in writing by the copyright owner as "Not a Contribution."
65+
66+ "Contributor" shall mean Licensor and any individual or Legal Entity
67+ on behalf of whom a Contribution has been received by Licensor and
68+ subsequently incorporated within the Work.
69+
70+ 2. Grant of Copyright License. Subject to the terms and conditions of
71+ this License, each Contributor hereby grants to You a perpetual,
72+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73+ copyright license to reproduce, prepare Derivative Works of,
74+ publicly display, publicly perform, sublicense, and distribute the
75+ Work and such Derivative Works in Source or Object form.
76+
77+ 3. Grant of Patent License. Subject to the terms and conditions of
78+ this License, each Contributor hereby grants to You a perpetual,
79+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80+ (except as stated in this section) patent license to make, have made,
81+ use, offer to sell, sell, import, and otherwise transfer the Work,
82+ where such license applies only to those patent claims licensable
83+ by such Contributor that are necessarily infringed by their
84+ Contribution(s) alone or by combination of their Contribution(s)
85+ with the Work to which such Contribution(s) was submitted. If You
86+ institute patent litigation against any entity (including a
87+ cross-claim or counterclaim in a lawsuit) alleging that the Work
88+ or a Contribution incorporated within the Work constitutes direct
89+ or contributory patent infringement, then any patent licenses
90+ granted to You under this License for that Work shall terminate
91+ as of the date such litigation is filed.
92+
93+ 4. Redistribution. You may reproduce and distribute copies of the
94+ Work or Derivative Works thereof in any medium, with or without
95+ modifications, and in Source or Object form, provided that You
96+ meet the following conditions:
97+
98+ (a) You must give any other recipients of the Work or
99+ Derivative Works a copy of this License; and
100+
101+ (b) You must cause any modified files to carry prominent notices
102+ stating that You changed the files; and
103+
104+ (c) You must retain, in the Source form of any Derivative Works
105+ that You distribute, all copyright, patent, trademark, and
106+ attribution notices from the Source form of the Work,
107+ excluding those notices that do not pertain to any part of
108+ the Derivative Works; and
109+
110+ (d) If the Work includes a "NOTICE" text file as part of its
111+ distribution, then any Derivative Works that You distribute must
112+ include a readable copy of the attribution notices contained
113+ within such NOTICE file, excluding those notices that do not
114+ pertain to any part of the Derivative Works, in at least one
115+ of the following places: within a NOTICE text file distributed
116+ as part of the Derivative Works; within the Source form or
117+ documentation, if provided along with the Derivative Works; or,
118+ within a display generated by the Derivative Works, if and
119+ wherever such third-party notices normally appear. The contents
120+ of the NOTICE file are for informational purposes only and
121+ do not modify the License. You may add Your own attribution
122+ notices within Derivative Works that You distribute, alongside
123+ or as an addendum to the NOTICE text from the Work, provided
124+ that such additional attribution notices cannot be construed
125+ as modifying the License.
126+
127+ You may add Your own copyright statement to Your modifications and
128+ may provide additional or different license terms and conditions
129+ for use, reproduction, or distribution of Your modifications, or
130+ for any such Derivative Works as a whole, provided Your use,
131+ reproduction, and distribution of the Work otherwise complies with
132+ the conditions stated in this License.
133+
134+ 5. Submission of Contributions. Unless You explicitly state otherwise,
135+ any Contribution intentionally submitted for inclusion in the Work
136+ by You to the Licensor shall be under the terms and conditions of
137+ this License, without any additional terms or conditions.
138+ Notwithstanding the above, nothing herein shall supersede or modify
139+ the terms of any separate license agreement you may have executed
140+ with Licensor regarding such Contributions.
141+
142+ 6. Trademarks. This License does not grant permission to use the trade
143+ names, trademarks, service marks, or product names of the Licensor,
144+ except as required for reasonable and customary use in describing the
145+ origin of the Work and reproducing the content of the NOTICE file.
146+
147+ 7. Disclaimer of Warranty. Unless required by applicable law or
148+ agreed to in writing, Licensor provides the Work (and each
149+ Contributor provides its Contributions) on an "AS IS" BASIS,
150+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151+ implied, including, without limitation, any warranties or conditions
152+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153+ PARTICULAR PURPOSE. You are solely responsible for determining the
154+ appropriateness of using or redistributing the Work and assume any
155+ risks associated with Your exercise of permissions under this License.
156+
157+ 8. Limitation of Liability. In no event and under no legal theory,
158+ whether in tort (including negligence), contract, or otherwise,
159+ unless required by applicable law (such as deliberate and grossly
160+ negligent acts) or agreed to in writing, shall any Contributor be
161+ liable to You for damages, including any direct, indirect, special,
162+ incidental, or consequential damages of any character arising as a
163+ result of this License or out of the use or inability to use the
164+ Work (including but not limited to damages for loss of goodwill,
165+ work stoppage, computer failure or malfunction, or any and all
166+ other commercial damages or losses), even if such Contributor
167+ has been advised of the possibility of such damages.
168+
169+ 9. Accepting Warranty or Additional Liability. While redistributing
170+ the Work or Derivative Works thereof, You may choose to offer,
171+ and charge a fee for, acceptance of support, warranty, indemnity,
172+ or other liability obligations and/or rights consistent with this
173+ License. However, in accepting such obligations, You may act only
174+ on Your own behalf and on Your sole responsibility, not on behalf
175+ of any other Contributor, and only if You agree to indemnify,
176+ defend, and hold each Contributor harmless for any liability
177+ incurred by, or claims asserted against, such Contributor by reason
178+ of your accepting any such warranty or additional liability.
179+
180+ END OF TERMS AND CONDITIONS
181+
182+ APPENDIX: How to apply the Apache License to your work.
183+
184+ To apply the Apache License to your work, attach the following
185+ boilerplate notice, with the fields enclosed by brackets "[]"
186+ replaced with your own identifying information. (Don't include
187+ the brackets!) The text should be enclosed in the appropriate
188+ comment syntax for the file format. We also recommend that a
189+ file or class name and description of purpose be included on the
190+ same "printed page" as the copyright notice for easier
191+ identification within third-party archives.
192+
193+ Copyright [yyyy] [name of copyright owner]
194+
195+ Licensed under the Apache License, Version 2.0 (the "License");
196+ you may not use this file except in compliance with the License.
197+ You may obtain a copy of the License at
198+
199+ http://www.apache.org/licenses/LICENSE-2.0
200+
201+ Unless required by applicable law or agreed to in writing, software
202+ distributed under the License is distributed on an "AS IS" BASIS,
203+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
204+ See the License for the specific language governing permissions and
205+ limitations under the License.
tests/syntax-tests/source/Vyper/crowdsale.vynew file+89
@@ -0,0 +1,89 @@
1+# IndividuallyCappedCrowdsale
2+# Contributors: Binod Nirvan
3+# This file is released under Apache 2.0 license.
4+# @dev Crowdsale with a limit for total contributions.
5+# Ported from Open Zeppelin
6+# https://github.com/OpenZeppelin
7+#
8+# See https://github.com/OpenZeppelin
9+# Open Zeppelin tests ported: Crowdsale.test.js
10+
11+
12+#@dev ERC20/223 Features referenced by this contract
13+contract TokenContract:
14+ def transfer(_to: address, _value: uint256) -> bool: modifying
15+
16+# Event for token purchase logging
17+# @param _purchaser who paid for the tokens
18+# @param _beneficiary who got the tokens
19+# @param _value weis paid for purchase
20+# @param _amount amount of tokens purchased
21+TokenPurchase: event({_purchaser: indexed(address), _beneficiary: indexed(address), _value: uint256(wei), _amount: uint256})
22+
23+# The token being sold
24+token: public(address)
25+
26+#Address where funds are collected
27+wallet: public(address)
28+
29+# How many token units a buyer gets per wei.
30+# The rate is the conversion between wei and the smallest and indivisible token unit.
31+# So, if you are using a rate of 1 with a DetailedERC20 token with 3 decimals called TOK
32+# 1 wei will give you 1 unit, or 0.001 TOK.
33+rate: public(uint256)
34+
35+#Amount of wei raised
36+weiRaised: public(uint256(wei))
37+
38+@public
39+def __init__(_rate: uint256, _wallet: address, _token: address):
40+ """
41+ @dev Initializes this contract
42+ @param _rate Number of token units a buyer gets per wei
43+ @param _wallet Address where collected funds will be forwarded to
44+ @param _token Address of the token being sold
45+ """
46+
47+ assert _rate > 0, "Invalid value supplied for the parameter \"_rate\"."
48+ assert _wallet != ZERO_ADDRESS, "Invalid wallet address."
49+ assert _token != ZERO_ADDRESS, "Invalid token address."
50+
51+ self.rate = _rate
52+ self.wallet = _wallet
53+ self.token = _token
54+
55+@private
56+@constant
57+def getTokenAmount(_weiAmount: uint256) -> uint256:
58+ return _weiAmount * self.rate
59+
60+
61+@private
62+def processTransaction(_sender: address, _beneficiary: address, _weiAmount: uint256(wei)):
63+ #pre validate
64+ assert _beneficiary != ZERO_ADDRESS, "Invalid address."
65+ assert _weiAmount != 0, "Invalid amount received."
66+
67+ #calculate the number of tokens for the Ether contribution.
68+ tokens: uint256 = self.getTokenAmount(as_unitless_number(_weiAmount))
69+
70+ self.weiRaised += _weiAmount
71+
72+ #process purchase
73+ assert TokenContract(self.token).transfer(_beneficiary, tokens), "Could not forward funds due to an unknown error."
74+ log.TokenPurchase(_sender, _beneficiary, _weiAmount, tokens)
75+
76+ #forward funds to the receiving wallet address.
77+ send(self.wallet, _weiAmount)
78+
79+ #post validate
80+
81+@public
82+@payable
83+def buyTokens(_beneficiary: address):
84+ self.processTransaction(msg.sender, _beneficiary, msg.value)
85+
86+@public
87+@payable
88+def __default__():
89+ self.processTransaction(msg.sender, msg.sender, msg.value)