Commit Graph

293 Commits

Author SHA1 Message Date
chriseth
5b1c0506fa Allow `memory` suffix for internal elementary type parsing. 2018-04-05 16:06:04 +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
Daniel Kirchner
0d0c9b8688 DocStringParser: Fix error message for empty parameter description. 2018-03-14 10:14:35 +01: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
Alex Beregszaszi
6948758156 Limit parser recursion depth further (needed by increased assembly data structure size) 2017-09-20 11:16:23 +02: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
628b54ce35 Reduce max recursion depth. 2017-08-22 12:44:23 +02: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
Alex Beregszaszi
e2cfc9ee92 Mark a lot of functions const (where possible) 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
chriseth
72917c4f35 Cleanup fixed point type changes 2017-07-19 22:13:42 +01:00
VoR0220
78769f3b39 Change fixed point types to have digit count
Signed-off-by: VoR0220 <rj@erisindustries.com>
2017-07-19 21:49:01 +01:00
Alex Beregszaszi
c99d049ac0 Update parser error for pragma/import/contract 2017-07-18 21:23:49 +01:00
Alex Beregszaszi
b615b01449 Move UndefMacros from libdevcore to libsolidity/parsing 2017-07-02 00:09:46 +01:00
Alex Beregszaszi
007ffe9430 Avoid including Scanner.h in ParserBase.h 2017-06-22 22:22:19 +01:00
Alex Beregszaszi
d5f8ce90c7 Merge interface/Exceptions and interface/Utils 2017-06-22 11:25:07 +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
3459052ae8 Add scanner helpers to ParserBase 2017-05-26 20:44:34 +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
chriseth
bb06569dc6 Disallow octal literals. 2017-03-07 12:34:32 +01:00
chriseth
0e021e76a5 Minor changes. 2017-01-27 11:19:48 +01:00
Lefteris Karapetsas
98b51b378e
More verbose function naming 2017-01-27 00:09:00 +01:00
Lefteris Karapetsas
cc7834f2a9
Doc tags followed by newline are now parsed properly 2017-01-27 00:00:05 +01:00
Lefteris Karapetsas
9ca0fde853 Fix and better output for tests 2017-01-25 11:01:52 +01:00
Lefteris Karapetsas
5738e865d5 Accept any kind of whitespace after natspec tags 2017-01-25 11:01:52 +01:00
Federico Bond
584356e7f6 Rename contractName to typeName when parsing new expression 2017-01-04 23:09:10 -03:00
Yoichi Hirai
43b56a61aa
parsing: default and null are reserved keywords 2016-12-02 11:52:11 +01:00
chriseth
5789eaa78d Metadata stamp. 2016-12-01 16:03:59 +01:00
Yoichi Hirai
eaab712944
parser: recognize an end of comment of the form **/ at the end of a multi-line doc comment
This fixes #1433
2016-11-30 17:28:07 +01: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
chriseth
462fc84e53 Merge pull request #1016 from ethereum/reserved
Report the usage of reserved keywords more nicely
2016-09-06 15:52:44 +02:00
Alex Beregszaszi
a13c5b3157 Raise proper error on reserved keywords 2016-09-06 12:03:05 +01:00
Alex Beregszaszi
cfb6dfc35e Introduce isReservedKeyword() 2016-09-06 12:01:02 +01:00
Alex Beregszaszi
496b7ea1d2 Reserve view and pure as keywords 2016-09-06 11:37:00 +01: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
Alex Beregszaszi
ec3298535e Introduce hex literals (#832)
* Introduce hex keyword token

* Support hex literals

* Include tests for hex literals

* Document hex literals
2016-08-16 16:31:23 +02:00
Alex Beregszaszi
970260bf0f Reserved keywords update (#833)
* Reserve abstract, interface and payable keywords

* Keywords as and using aren't reserved anymore - they're used

* Reserve the static keyword
2016-08-16 16:28:45 +02:00
Denton Liu
cab8e63a0e Revert "Change After to a deprecated token"
This reverts commit 91c97f73b50fc87662b5490b2fe6de1c6ef376c7.
2016-08-11 10:15:59 -04:00
Denton Liu
be98d3db51 Change After to a deprecated token 2016-08-11 10:15:59 -04:00
Denton Liu
0988eba4fe Remove after from Token.h 2016-08-11 10:15:59 -04:00
Alex Beregszaszi
6db12c4f88 Rename addUnicodeChar to addUnicodeAsUTF8 2016-08-04 17:28:48 +01:00
Alex Beregszaszi
aa4593cab3 Support Unicode escape characters in string literals ('\uUUUU')
Fixes #638
2016-08-04 17:28:48 +01:00
Denton Liu
8fbe994075 Fix isCompareOp() 2016-07-20 17:05:24 -04:00
Denton Liu
827208d1d6 Move in as a keyword to reserved word section 2016-07-20 15:42:18 -04:00
Alex Beregszaszi
f8ccf3eebf Fix Token::isBitOp to exclude shift operators 2016-06-07 19:39:05 +01:00
VoR0220
bfc238c8d1 updated algorithm for bit finding...now to figure out literal value
tiny fixups

changed location of the check

got rid of extra space and fixed a couple of things

added binary results bits

change back literal value
2016-05-09 11:41:03 -05:00
RJ Catalano
93295ae8f8 got exponents up and working with their inverse, changed a few of the tests....something is working that likely shouldn't be
slight changes to how to flip the rational negative around...still trying to figure it out

tests added

updated tests

odd differences in trying soltest from solc binary, let me know if you can replicate

test not working for odd reason

fixed test problem with fixed literals...still need a way to log this error

broken up the tests, added some, changed some things in types and began compiler work

moar tests and prepping for rebuilding much of the types.cpp file

further fixing

infinite loop still happening but it's somewhere in the fixedPoint methodd

fractional bits needed algo improved! Eliminated 2 errors

Corrected problems with the previous commit. No infinite loops. Actually appear to have corrected an error
2016-05-09 11:41:02 -05:00
RJ Catalano
91fda50922 fixed problem with var...probably a conversion problem for fixed in size capabilities
adding fixed type tests

Removing bitshift and regrouping fixed type tests together
2016-05-09 11:41:02 -05:00
RJ Catalano
dff1a26f55 fix for token bug, also quick fix for the wei and seconds 2016-05-09 11:41:02 -05:00
RJ Catalano
9a075458ad initial work for fixed types...potentially needing a constant literal type for this
notation

Rational implemented...trying to figure out exponential

fix for token bug, also quick fix for the wei and seconds

fixed problem with var...probably a conversion problem for fixed in size capabilities

adding fixed type tests

Removing bitshift and regrouping fixed type tests together

size capabilities functioning properly for fixed types

got exponents up and working with their inverse, changed a few of the tests....something is working that likely shouldn't be

slight changes to how to flip the rational negative around...still trying to figure it out

tests added

updated tests

odd differences in trying soltest from solc binary, let me know if you can replicate

test not working for odd reason

fixed test problem with fixed literals...still need a way to log this error

broken up the tests, added some, changed some things in types and began compiler work

moar tests and prepping for rebuilding much of the types.cpp file

further fixing

initial work for fixed types...potentially needing a constant literal type for this
2016-05-09 11:41:02 -05:00
chriseth
6f54b13d7a Remove log.h from solidity. 2016-04-12 01:03:46 +02:00
VoR0220
3fc67245bf readding conditionals but with slight changes 2016-03-31 12:15:49 -05:00
VoR0220
1b39d3b5d4 solAsserts added and some changes rolled back. 2016-03-30 13:15:54 -05:00
VoR0220
9404600b3f helper function in scanner and corresponding edits to parserBase 2016-03-30 13:09:38 -05:00
VoR0220
6c61e28dc2 Got it working exactly like you wanted ;) 2016-03-30 11:54:00 -05:00
VoR0220
6395168371 change lexical cast to unsigned int 2016-03-30 11:54:00 -05:00
VoR0220
ddd16d7655 Fix for Token::name and token::toString 2016-03-30 11:54:00 -05: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
9b00290d74 Remove timestamp again and some fixes for ufixed parsing. 2016-03-11 17:50:09 +01:00
RJ Catalano
d0054a8d29 added keyword type and some tests, changes in lexical cast 2016-03-11 17:50:09 +01:00
RJ Catalano
b8bcb706e9 stylistic change, and got lexical cast to work with an iterator range 2016-03-11 17:49:32 +01:00
LianaHus
58e07151e3 - inline and assembly keywords added
- some style fixes
2016-03-11 17:49:32 +01:00
RJ Catalano
67793f1aed changed documentation and using lexical cast 2016-03-11 17:49:32 +01:00
RJ Catalano
9f5c3977fb changed extractUnsigned to handle iterators rather than a string 2016-03-11 17:49:32 +01:00
RJ Catalano
2738f4066a changed 1 to 0 in invalid argument catch block 2016-03-11 17:49:32 +01:00
RJ Catalano
93114949a3 needed this one string of notation 2016-03-11 17:49:32 +01:00
RJ Catalano
953e92b6f5 added from identifier or keyword handling of fixed types 2016-03-11 17:49:32 +01:00
RJ Catalano
29b74be413 fixed keyword added in for token type 2016-03-11 17:49:32 +01:00
chriseth
94cbf15cfc Buildfix. 2016-02-22 18:12:58 +01:00
chriseth
968934c05d Move reusable parser components into base class. 2016-02-22 18:02:29 +01:00
RJ Catalano
9b67969fd6 further optimization, splitting function into pieces
generating strings on the fly, changed name, and added two tests
2016-02-18 11:23:00 -06:00
RJ Catalano
d2c0712f36 added const correctness to extract functions in Token
optimizations added in

more elegant solution created for m declaration

ubuntu wants to get rid of 0 <= first statement...so I will

change returnToken to token
2016-02-18 11:22:58 -06: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
chriseth
33b02a0d1b Fix uint178 problem. 2016-01-25 21:05:13 +01: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
chriseth
b4f561680a Store docstrings in AST annotations. 2015-10-26 15:24:36 +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