diff options
| author | Georg Brandl <georg@python.org> | 2019-11-26 07:05:23 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2019-11-26 07:05:30 +0100 |
| commit | be43f33d42387e0122244a1a6a99493976459831 (patch) | |
| tree | e50ad1058d234fb9e89c5f1a6d5b63a7d3e063c9 /tests | |
| parent | 731339d7654fa69d3eaa5ebe2a1d29b1cee6724e (diff) | |
| download | pygments-git-be43f33d42387e0122244a1a6a99493976459831.tar.gz | |
Add Solidity lexer.
Fixes #1214
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/examplefiles/test.sol | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/examplefiles/test.sol b/tests/examplefiles/test.sol new file mode 100644 index 00000000..f7a6495e --- /dev/null +++ b/tests/examplefiles/test.sol @@ -0,0 +1,74 @@ +pragma solidity ^0.4.20; + +pragma solidity >=0.4.0 <0.7.0; + +// one-line singleline comment + +/* one-line multiline comment */ + +/* + multi-line multiline comment +*/ + +contract ContractName { + + address public publicaddress; + + uint varname1 = 1234; + int varname2 = 0x12abcdEF; + + string astringsingle = 'test "string" value\' single'; + string astringdouble = "test 'string' value\" double"; + + enum State { + NotStarted, + WorkInProgress, + Done + } + State public state; + + struct AStruct { + string name; + uint8 type; + } + + mapping(address => AStruct) registry; + + event Paid(uint256 value); + event Received(uint256 time); + event Withdraw(uint256 value); + + function addRegistry(string _name, uint8 _type) { + AStruct memory newItem = AStruct({ + name: _name, + type: _type + }); + + registry[msg.sender] = newItem; + } + + function getHash(AStruct item) returns(uint) { + return uint(keccak256(item.name, item.type)); + } + + function pay() public payable { + require(msg.sender == astronaut); + state = State.Paid; + Paid(msg.value); + } + + function receive() public { + require(msg.sender == arbiter); + require(state == State.Paid); + state = State.Received; + Received(now); + } + + function withdraw() public { + require(msg.sender == shipper); + require(state == State.Received); + state = State.Withdrawn; + Withdraw(this.balance); + shipper.transfer(this.balance); + } +} |
