Commit Graph

235 Commits

Author SHA1 Message Date
Mathias Baumann
efc8d79d53 Fix wrong location for inline asm blocks 2019-04-15 16:40:07 +02:00
Christian Parpart
bb28c8a877 Fixes wrong source location when reporting pragma solidity version conflicts. 2019-03-20 11:42:25 +01:00
chriseth
9a949c1bda Set default EVM version to Petersburg. 2019-03-04 14:53:00 +01:00
Alex Beregszaszi
ecd246aeb6 Support petersburg in evmVersion 2019-03-04 14:10:41 +01:00
chriseth
7f5b335b47 Make EVM version part of EVM dialect. 2019-02-21 21:59:46 +01:00
Alex Beregszaszi
fcf884f201 Do not ignore fatal error in AsmParser for inline assembly 2019-02-21 16:18:53 +00:00
chriseth
1a823f0bf8 Fix tabs/spaces. 2019-02-13 17:05:48 +01:00
Alex Beregszaszi
9aafa32825 Disallow empty import statements 2019-01-28 13:52:15 +00:00
chriseth
2fcfb216b5 Syntax for meta type information. 2019-01-17 20:36:48 +01:00
Christian Parpart
62fe57479e
make use of C++ = default constructor declarations as well as more non-static member initialization syntax. 2018-12-19 11:26:42 +01:00
Christian Parpart
d10bae245e
liblangutil: SourceLocation to default initialize data members (w/o the use of ctor)
See: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c45-dont-define-a-default-constructor-that-only-initializes-data-members-use-in-class-member-initializers-instead
2018-12-19 11:21:45 +01:00
Alex Beregszaszi
c2ec6d71b4 Add version pragma parsing to Parser 2018-12-18 15:02:35 +00:00
Leonardo Alt
7f41487ff6 Sort includes in libsolidity/parsing 2018-12-17 19:28:10 +01:00
chriseth
fb3a0ac1c7 Codegen for object access. 2018-12-11 19:24:44 +01:00
Mathias Baumann
2f6dc2e773 Replace push_back with emplace_back where it makes sense 2018-12-10 19:02:39 +01:00
Christian Parpart
c48a5264be
liblangutil: SourceLocation: adds (shared) pointer to underlying CharStream source, eliminating sourceName
Also, adapted affecting code to those changes.
2018-11-30 17:07:12 +01:00
Christian Parpart
e4106bd06e Change scanner error diagnostics to be non-intrusive to the token API.
This also implicitly eliminates the magic-token Token::IllegalHex, and
streamlines error diagnostics over a custom enum class.
2018-11-24 12:40:51 +01:00
Lazaridis
e454737a3c adapt to latest code changes 2018-11-23 17:27:52 +01:00
Christian Parpart
ec47c8946b
Isolating libyul library API into its own namespace yul. 2018-11-23 14:29:00 +01:00
Christian Parpart
713d94476e Reorder some include files and group <libyul/>'s together (as much as possible) 2018-11-23 12:37:19 +01:00
Christian Parpart
0f4ed52a71
Rewrite header paths to adapt to recent git mv of libsolidity/inlineasm to libyul 2018-11-23 11:18:57 +01:00
Christian Parpart
d67322a186 Introduce namespace langutil in liblangutil directory.
Also:
- Use {}-style list initialisation for SourceLocation construction
- Introduce new system includes
- Changes the API of the Scanner to take source as value (with move) as opposed to as a reference
2018-11-21 19:13:44 +00:00
Christian Parpart
87821c53c3 Isolating files shared between Yul- and Solidity language frontend. 2018-11-21 18:58:12 +00:00
chriseth
af65bac737 Remove trailing whitespace. 2018-11-12 09:15:22 +01:00
Christian Parpart
f112377dd4
Refactor solidity::Token into an enum class with TokenTraits helper namespace 2018-10-22 17:00:51 +02:00
chriseth
06200b4b64
Merge pull request #5180 from ethereum/cpp-cleanup
Some C++ cleanup
2018-10-10 11:43:42 +02:00
Alex Beregszaszi
6c3d12d85b Do not require ctype/stdio if not needed 2018-10-09 19:06:22 +01:00
Lazaridis
4bcd89105c provide general hex-literal error message, fixes #1802
dummy
2018-10-09 06:51:19 +03:00
Alex Beregszaszi
fa0ce6a7e7 Use empty() instead of size() == 0 2018-10-09 04:29:37 +01:00
Daniel Kirchner
1ce3581a52 Accept `address payable` during parsing. 2018-09-11 14:52:23 +02:00
Daniel Kirchner
f020f96b6c More consistently use parse*() functions without argument in the parser. 2018-09-06 14:55:07 +02:00
chriseth
85debe77d9
Merge pull request #4866 from bakaoh/issue4743
Fix#4743: Incorrect source location for nameless parameters
2018-09-04 20:21:03 +02:00
bakaoh
c458f5988b Fix#4743: Incorrect source location for nameless parameters 2018-08-28 11:11:40 +07:00
Chase McDermott
551e0bf47c Rename Location::Default to Location::Unspecified. 2018-08-17 18:15:22 -05:00
Erik Kundt
182a0a9551 Disallows old constructor syntax. 2018-07-18 14:29:01 +02:00
Daniel Kirchner
3984beef7d Remove constant keyword from parser. 2018-07-03 15:31:34 +02:00
Erik Kundt
2e9f5d1c98 Introduces emit token and removes identifier workaround. 2018-06-11 21:21:22 +01:00
mingchuan
b7cafcbdf9
Allow using calldata keyword to specify data location 2018-05-30 18:05:55 +08:00
chriseth
3ca6738114 Add assert about source location. 2018-05-16 03:52:24 +02:00
chriseth
67d208d144 Parse multi variable declaration statement. 2018-05-16 03:22:45 +02:00
chriseth
fe8f38a7a4 Assert integrity of empty IndexAccessPath structure. 2018-05-09 14:55:36 +02:00
chriseth
be54f48197 Further refactor. 2018-05-09 11:48:21 +02:00
chriseth
86b7adc18f Refactor expression parser. 2018-05-09 11:48:21 +02:00
Alex Beregszaszi
cc10839073 Have more uniform parser errors 2018-05-04 13:27:05 +01:00
Alex Beregszaszi
ed9f80690b Simplify expectIdentifierToken by using expectToken 2018-05-03 22:10:51 +01:00
Alex Beregszaszi
73c99d15cd Remove useless helper expectAssignmentOperator in parser 2018-05-03 21:35:38 +01:00
chriseth
d44fb03322 Refactor parser. 2018-04-26 10:59:02 +02:00
Daniel Kirchner
6862f22943 Fix internal compiler error when parsing `var` declaration without identifier. 2018-04-12 14:57:14 +02:00
chriseth
b5a696ad48 Properly cope with constructor headers. 2018-04-11 22:00:21 +02:00
chriseth
2ad1acaf72 Warn if modifiers are applied to functions without implementation. 2018-04-11 22:00:21 +02:00
chriseth
6d289783b4 Fix state variable parsing. 2018-04-11 22:00:04 +02:00
Daniel Kirchner
3eedbc6a9c Error when using no parentheses in modifier-style constructor calls. 2018-04-10 12:09:34 +02:00
Daniel Kirchner
96eff0ff6a Error when using empty parenthesis for base class constructors that require arguments. 2018-04-05 11:52:22 +02:00
Daniel Kirchner
8f66390f56 Set isConstructor to false unconditionally and update to true later for constructors. 2018-04-03 18:21:55 +02:00
Daniel Kirchner
e2dac9ed39 Set header.isConstructor for old style constructors in parseFunctionHeader as well. 2018-04-03 18:21:55 +02:00
Daniel Kirchner
d664a599e6 Constructors are defined using the `constructor` keyword. 2018-04-03 18:21:55 +02:00
chriseth
388718b59f Introduce emit statement. 2018-02-22 15:17:30 +01:00
chriseth
e2bf5de8a2 Expect end of string at end of top-level block for assembly parser. 2018-02-21 00:41:39 +01:00
Federico Bond
14fd647b85 Fix event parsing. Refs #3175 2017-11-22 23:08:12 -03:00
chriseth
639b85f498 Fix source location of VariableDeclarationStatement. 2017-09-27 19:27:36 +02:00
wadeAlexC
0099911ace Better error message for unexpected trailing comma in parameter lists 2017-09-25 10:42:01 +01:00
chriseth
122e65f8f4 Crash fix, parseTypeName can return null. 2017-08-28 15:13:02 +02:00
Alex Beregszaszi
da56bde58f Move the break in switch for readability 2017-08-25 16:02:05 +01:00
Alex Beregszaszi
f2317670fa Remove two other fall-through cases in Parser 2017-08-25 14:24:07 +01:00
Alex Beregszaszi
ef8355da7f Remove fallthrough from literal parsing 2017-08-25 14:22:59 +01:00
Alex Beregszaszi
5668377c72 Introduce pure specifier on functions 2017-08-24 13:46:18 +01:00
chriseth
8af6f193bc Merge pull request #2770 from ethereum/recursionInAsm
Also prevent too much recursion in the assembly parser.
2017-08-24 11:14:01 +02:00
Alex Beregszaszi
efe4d68a7b Introduce view (and keep constant as an alias) 2017-08-22 18:24:22 +01:00
chriseth
692e4c57e8 Check recursion depth in assembly parser. 2017-08-22 12:44:22 +02:00
Alex Beregszaszi
2a5772cff7 Mark appropriate constructors explicit 2017-08-22 10:51:46 +01:00
chriseth
32e43477c3 Prevent too deep recursion in parser. 2017-08-14 22:19:15 +02:00
Alex Beregszaszi
2a9ba937ba Replace constant/payable with StateMutability in AST 2017-08-14 14:21:47 +01:00
Federico Bond
a8c047f48d Enforce commas in tuple syntax 2017-08-11 17:28:48 +01:00
Alex Beregszaszi
b210db8058 Make toString(visibility) a helper 2017-08-09 14:58:59 +01:00
Alex Beregszaszi
efd45f64a5 Show previous visibility specifier in parser error 2017-08-09 14:30:17 +01:00
Alex Beregszaszi
a8ca623a0f Add test for multiple visibilites on functions 2017-08-09 14:30:02 +01:00
Alex Beregszaszi
3b41cd3c23 Rename Token::Const to Token::Constant 2017-08-09 12:50:53 +01:00
Alex Beregszaszi
c99d049ac0 Update parser error for pragma/import/contract 2017-07-18 21:23:49 +01:00
chriseth
622703c0c0 Merge pull request #2409 from federicobond/trailing-commas-2
Improve error reporting of trailing commas
2017-06-19 12:01:19 +02:00
Federico Bond
d170ceaf3d Display error if payable or constant is specified multiple times 2017-06-17 12:21:46 -03:00
Federico Bond
0eaae03bbf Try to recover from parser errors where possible 2017-06-15 21:14:05 -03:00
Federico Bond
60bfae75e5 Improve error reporting of trailing commas 2017-06-15 13:10:08 -03:00
Federico Bond
fd8365df08 Forbid trailing commas in named arguments 2017-06-14 00:15:27 -03:00
Rhett Aultman
89b60ffbd4 Refactor error reporting
This commit introduces ErrorReporter, a utility class which consolidates
all of the error logging functionality into a common set of functions.
It also replaces all direct interactions with an ErrorList with calls to
an ErrorReporter.

This commit resolves issue #2209
2017-05-30 07:28:31 -07:00
Alex Beregszaszi
751c97ca19 Pull out common code to a helper 2017-05-26 21:40:14 +01:00
Alex Beregszaszi
48f58aa3f9 Remove duplicate code 2017-05-26 21:02:31 +01:00
Alex Beregszaszi
2fefe3b549 Move Solidity specific methods from ParserBase to the Solidity Parser 2017-05-26 20:44:34 +01:00
Alex Beregszaszi
81877cc594 Rename InterfaceHandler to Natspec 2017-05-19 16:11:04 +01:00
Alex Beregszaszi
f8da9a8fd5 Factor out tokenToContractKind 2017-03-17 17:06:52 +00:00
Alex Beregszaszi
54230d2d5d Support interface (contract) keyword in the parser 2017-03-17 16:27:04 +00:00
Alex Beregszaszi
6d4628ace4 Add ContractKind to ContractDefinition 2017-03-17 16:27:04 +00:00
Federico Bond
584356e7f6 Rename contractName to typeName when parsing new expression 2017-01-04 23:09:10 -03:00
VoR0220
3f9f725737 Fix licensing headers
Signed-off-by: VoR0220 <rj@erisindustries.com>
2016-11-23 12:22:33 +01:00
chriseth
7a292c9a05 Fix parser for function type disambiguity. 2016-11-16 14:37:19 +01:00
chriseth
97a3588701 Function type state variables. 2016-11-16 14:37:17 +01:00
chriseth
cc8583ec7d Function types. 2016-11-16 14:37:17 +01:00
Yoichi Hirai
eee629652e
parsing: ban empty enum definition. 2016-11-11 17:48:03 +01:00
Rhett Aultman
4524ad0870 Add support for do/while loops
This commit adds support for a standard do <statement> while <expr>;
form of statement.  While loops were already being supported; supporting
a do/while loop mostly involves reusing code from while loops but putting
the conditional checking last.
2016-11-10 07:07:25 -08:00
Alex Beregszaszi
962531af96 Merged in changes from chriseth/payable 2016-09-05 21:28:28 +02:00
Alex Beregszaszi
a34f2f1a31 Support payable keyword for functions 2016-09-05 21:28:18 +02:00
chriseth
02984b8de1 Require ";" after "_" 2016-09-05 14:54:50 +02:00
chriseth
3c412ed2f6 Version pragma. 2016-09-01 00:02:51 +02:00
chriseth
6f54b13d7a Remove log.h from solidity. 2016-04-12 01:03:46 +02:00
chriseth
f049430723 Code generation (missing external access and source locations). 2016-03-30 02:37:00 +02:00
chriseth
949b00ed59 Parsing for inline assembly. 2016-03-30 02:37:00 +02:00
chriseth
968934c05d Move reusable parser components into base class. 2016-02-22 18:02:29 +01:00
RJ Catalano
84f2eb461b added two functions in Token to handle long identifiers, redid fromIdentifierOrKeyword, and made complementary changes in scanner and parser 2016-02-18 11:22:58 -06:00
RJ Catalano
f4da126018 tests added and changes made
fixed some silly problems in Token.cpp

windows error fix
2016-02-18 11:22:56 -06:00
RJ Catalano
7b918a7bc7 changes to redefine the token list, the scanner, and the parser and how they pass around variable types of different sizes
not ready for change to FixedPoint just yet

made this more const correct and added a switch statement for easier reading
2016-02-18 11:22:52 -06:00
Lu Guanqun
b003290638 [cond-expr] fixup according to code review 2016-01-22 17:14:00 +00:00
Lu Guanqun
7eefa838a3 [cond-expr] parse _ ? _ : _ into conditional AST node 2016-01-22 17:14:00 +00:00
Paweł Bylica
31863528a4 Remove unnecesary std::move 2016-01-15 14:04:18 +01:00
chriseth
0e2fa39fad Use paths instead of simple identifiers wherever possible. 2015-12-21 18:44:21 +01:00
chriseth
6c6295b74e Merge pull request #311 from guanqun/correct-boolean-literal-position
correct true/false literal's source
2015-12-18 17:14:57 +01:00
Lu Guanqun
e4f713b55b correct true/false literal's source
Before:
        Literal, token: true value: true
           Type: bool
           Source: "true;"

After:
        Literal, token: true value: true
           Type: bool
           Source: "true"

Extra token is removed.
2015-12-18 23:48:34 +08:00
chriseth
603dc58040 Simple aliasing during import. 2015-12-18 12:46:56 +01:00
chriseth
d3c459b5a9 Parse complex import directives. 2015-12-18 12:46:54 +01:00
RJ Catalano
ed1dd50acd changed error message 2015-12-16 17:26:41 -06:00
RJ Catalano
905d55e34f updated tests and much simpler algorithm for parsing errors 2015-12-16 16:47:37 -06:00
RJ Catalano
fe04d7f7f7 added one more test and realized that there was one last change before the parser is perfect 2015-12-16 14:50:40 -06:00
RJ Catalano
de969945ea Parsing is complete 2015-12-16 13:17:41 -06:00
RJ Catalano
0ba24a5289 changed a couple of small nuances, made an attempt at fixing the parsing in the inline arrays case (fails), and added test for inline arrays per Chriseth request 2015-12-16 12:55:52 -06:00
RJ Catalano
aebce8a1d5 now is compiling and passing soltest...but I think there may be a few more things to do 2015-12-15 12:22:52 -06:00
RJ Catalano
5a462afd03 fixed case statements 2015-12-15 11:37:00 -06:00
RJ Catalano
84241804dc updated attempt...still a bit more work to do but here's what's current 2015-12-15 11:00:35 -06:00
RJ Catalano
42c4339404 updated attempt, a couple of more things to sort through and change 2015-12-15 10:57:57 -06:00
RJ Catalano
574e48b0b5 Inline array declarations complete 2015-12-14 17:40:35 -06:00
chriseth
d71cd3aa2b Added the using x for y directive. 2015-11-26 17:49:39 +01:00
chriseth
b47d593252 Do not store elements of a contract by AST node type. 2015-11-26 15:37:55 +01:00
chriseth
e06768e8b5 Fix MSVC errors and warnings. 2015-11-26 14:47:28 +01:00
chriseth
30b325fdc1 Allow "new expressions" also for general type names.
Breaking change: If you want to send value with a contract creation, you
have to use parentheses now:

`(new ContractName).value(2 ether)(arg1, arg2)`
2015-11-26 13:10:12 +01:00
chriseth
8fb49d85f9 Allow docstrings for statements. 2015-10-26 19:47:25 +01:00
LianaHus
d8865f9f05 more corrections 2015-10-23 12:56:50 +02:00
LianaHus
6e13853421 modified error msg 2015-10-23 12:44:26 +02:00
chriseth
e3dffb611f File reorganisation. 2015-10-21 00:46:01 +02:00