Commit Graph

228 Commits

Author SHA1 Message Date
Alex Beregszaszi
44e35e0652 Fix compilation errors with GCC 11 2021-05-17 11:35:07 +01:00
Alex Beregszaszi
60189b4f61 Remove obsolete Error constructor 2021-04-23 23:55:22 +01:00
chriseth
eb85a4414c Fix handling of carriage return. 2021-03-09 15:33:12 +01:00
chriseth
f4050e81c6 Provide locations for docstring parsing errors. 2021-03-01 17:34:25 +01:00
Alexander Arlt
c44bb7e7ef Replace raw throw with BOOST_THROW_EXCEPTION. 2021-02-18 20:23:59 -05:00
Christian Parpart
32ba5f5ae7 libsolidity: Extend the AST for named AST nodes in order to get precise locations for names.
The actual SourceLocation on an ASTNode is representing the whole
ASTNode whereas in an LSP (for example) you are also interested in the
SourceLocation of a name of a construct (e.g. variable decarlation, function definition, ...).

This also properly encodes non-existend sources as `-1` in the JSON output (eliminating the use of `numeric_limits<size_t>::max()`).
2021-02-10 18:13:09 +01:00
chriseth
a4769d446f Fail on assertion failures in yul code generation. 2021-01-14 14:51:16 +00:00
Alex Beregszaszi
8edfa26f0a Mark the empty version pragma as invalid 2021-01-04 19:28:36 +00:00
Alex Beregszaszi
b14a6a10cc Report meaningful error if parsing a version pragma failed 2020-12-18 11:50:37 +00:00
Alex Beregszaszi
97173247c0 Improve the Error class with a constructor for secondaryLocation
Remove occurances of Error construction using the boost helpers.
2020-12-17 13:50:04 +00:00
chriseth
8f833f4e8f
Merge pull request #10618 from ethereum/develop
Merge develop into breaking.
2020-12-16 12:34:41 +01:00
Christian Parpart
381c63ec99 Scanner: Generate error on inbalanced RLO/LRO/PDF override markers. 2020-12-15 18:40:51 +01:00
Alex Beregszaszi
15237c8404 Disable the type byte 2020-12-14 19:18:25 +00:00
chriseth
d257ab7141 Merge remote-tracking branch 'origin/develop' into breaking 2020-12-14 16:05:12 +01:00
Alex Beregszaszi
aa042ccb87 Disallow leading zeroes in sized-types
Also avoid using boost::lexical_cast for parseSize.
2020-12-14 11:40:14 +00:00
chriseth
561280a5cc Merge remote-tracking branch 'origin/develop' into breaking 2020-12-14 11:33:40 +01:00
Alex Beregszaszi
bd641a5206 Enable more C++ compiler warnings 2020-12-10 21:03:58 +00:00
Alex Beregszaszi
66ee3ec533 Remove the \b, \f, \v escape sequences from the Scanner 2020-12-07 21:10:03 +00:00
chriseth
c193ce6c07 Rename SourceReferenceFormatterHuman. 2020-12-01 16:09:46 +01:00
Alex Beregszaszi
4044817255 Drop old SourceReferenceFormatter 2020-12-01 16:09:46 +01:00
Alex Beregszaszi
1dedba8538 Only use SourceReferenceFormatterHuman 2020-12-01 16:09:46 +01:00
chriseth
6979952995 Merge remote-tracking branch 'origin/develop' into HEAD 2020-10-19 18:02:50 +02:00
chriseth
527c073bb9 Checked arithmetic by default. 2020-10-19 16:58:37 +02:00
Leonardo Alt
4e49135318 Add CLI option to choose model checker engine 2020-10-16 15:01:47 +01:00
hrkrshnn
13e7012e1e Parser: Exponentiation is right associative 2020-10-13 16:38:37 +02:00
chriseth
c4d8b4fa0e Fix error reporter for zero-length location. 2020-10-08 18:56:17 +02:00
chriseth
3102b98e82 Var is reserved keyword. 2020-10-06 15:08:57 +02:00
chriseth
cb2c9823c7
Merge pull request #9329 from ethereum/optimiser-token
Disallow language keywords to be used as identifiers by NameDispenser and VarNameCleaner
2020-08-31 19:33:07 +02:00
chriseth
0203eea20e
Merge pull request #9649 from a3d4/improve-error-coverage-erorrecovery
Complete test coverage for errors related to parser error recovery
2020-08-31 18:33:19 +02:00
Alex Beregszaszi
2ebc4bb9a7 Introduce TokenTraits::isYulKeyword helper 2020-08-31 11:55:27 +01:00
Alex Beregszaszi
7ef9591e64 Expose hex literal to the Yul parser
This allows nicer error messages.
2020-08-28 19:34:52 +01:00
Alex Beregszaszi
4366ede889 Introduce Leave as a keyword for Yul 2020-08-28 19:34:52 +01:00
Alex Beregszaszi
caa329066e Do not emit Solidity-only tokens in the Scanner for Yul
And simplfiy AsmParser greatly.
2020-08-28 19:34:52 +01:00
Alex Beregszaszi
662f7d8fac Rename Arrow to DoubleArrow 2020-08-27 12:28:27 +01:00
Alex Beregszaszi
4e5b403c37 Introduce RightArrow (->) token in the scanner 2020-08-27 12:28:27 +01:00
a3d4
0ee4a85a84 Complete test coverage for errors related to parser error recovery 2020-08-20 16:14:39 +02:00
Jason Cobb
888d7037cd
Make FunctionCallAnnotation::kind a SetOnce 2020-08-12 11:57:01 -04:00
Alex Beregszaszi
d9cb8c8c5e Add ScannerKind and replace supportPeriodInIdentifier 2020-07-28 12:31:08 +01:00
Alex Beregszaszi
6eb60bc8cd Add check that regular and unicode string literals are well formatted 2020-07-27 18:21:17 +01:00
Alex Beregszaszi
8abc1a6863 Check for invalid ASCII in the scanner 2020-07-27 18:21:17 +01:00
chriseth
1a1960ede0
Merge pull request #9466 from ethereum/fixTokens
Properly sort token list.
2020-07-27 10:42:31 +02:00
a3d4
5b54cfbed3 Report an error if immutables not assigned 2020-07-23 16:38:54 +02:00
chriseth
8cfbe02cc0 Fix token list. 2020-07-23 14:28:28 +02:00
chriseth
9be5ed1220 Merge remote-tracking branch 'origin/develop' into breaking 2020-07-21 11:35:28 +02:00
chriseth
93c792c696 Remove special treatment of `var`. 2020-07-20 17:22:04 +02:00
Sachin Grover
b7adb2aa42 Add SPDX license identifier if not present already in source file
Fixes: #9220
2020-07-17 20:24:12 +05:30
Harikrishnan Mulackal
f73b25bb78 Removed specialized errors related to constant state mutability 2020-07-14 12:42:47 +05:30
Daniel Kirchner
c3e13b6733 Promote gwei to a proper keyword. 2020-07-13 18:07:11 +02:00
Daniel Kirchner
38c6ecbbe2 Remove finney and szabo denominations. 2020-07-13 18:07:10 +02:00
Djordje Mijovic
547590b972 Fixing additional signedness errors after adding -Wsign-conversion flag
Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
2020-07-09 17:22:45 +02:00
chriseth
2d64f53a39
Merge pull request #9265 from a3d4/improve-fixerrorids-script
Add --examine-coverage to fix_error_ids.py
2020-07-02 11:18:46 +02:00
a3d4
919572d6ec Add --examine-coverage to fix_error_ids.py 2020-07-01 21:41:31 +02:00
Bhargava Shastry
1a0391bceb Fuzzer: Add a specialized StackTooDeepError Exception that is caught in the fuzzing harness 2020-07-01 11:08:20 +02:00
Mathias Baumann
02328f3bbb Add unit denomination `gwei` 2020-06-24 18:24:56 +02:00
a3d4
1d2ae7d82a Added error codes to SyntaxTest expectations (changed code) 2020-06-22 16:53:03 +02:00
a3d4
5d63fa09e9 Fix false ////- and /***-natspec 2020-06-16 11:15:04 +02:00
Djordje Mijovic
731b2efc97 Fixing liblangutil conversion warnings 2020-06-11 08:26:57 +02:00
a3d4
51e64fe0b1 Add error IDs to console output 2020-06-10 13:27:25 +02:00
Djordje Mijovic
5b1426b55e Adding fixes for signedness warnings in liblangutil 2020-06-03 11:22:46 +02:00
chriseth
de5e283574
Merge pull request #9085 from a3d4/refactor-error-ids-script
Refactor error ID checker script
2020-06-03 11:12:42 +02:00
a3d4
3bf236cf81 Refactor error ID checker script 2020-06-03 02:43:20 +02:00
a3d4
41d8420718 Fix tabs in SolcReferenceFormatterHuman 2020-06-02 21:43:51 +02:00
chriseth
65d8b6cf75
Merge pull request #9033 from a3d4/partfix-5819-add-errorid-to-error-class
Add unique ID to Error class
2020-05-28 16:24:47 +02:00
a3d4
c959341720 Add errorId to Error class 2020-05-28 15:00:33 +02:00
chriseth
eb923af09c Do not set source locations for small internal assembly routines. 2020-05-27 18:26:46 +02:00
Mathias Baumann
7f3d437ffe Fix caret position for errors with utf source 2020-05-25 14:27:03 +02:00
hrkrshnn
37257548d0 Fixed bug when two empty NatSpec comments led to scanning past EOL 2020-05-20 20:26:02 +05:30
a3d4
9f8d5753ce Introduce ErrorWatcher and remove a dedicated error flag from AsmAnalyzer 2020-05-18 16:06:23 +02:00
chriseth
3872a1f000 Add support for SPDX license identifiers. 2020-05-13 18:16:59 +02:00
a3d4
02d1f8c41a Remove a dedicated error flag from DeclarationTypeChecker 2020-05-12 18:13:17 +02:00
a3d4
c3e519a151 Add unique IDs to error reporting calls 2020-05-09 01:28:55 +02:00
a3d4
6965f199fd Groundwork. Prepare for automatic tagging of errors in parser-based classes
[Not compilable until the next commit]
2020-05-09 01:03:02 +02:00
a3d4
2d984b77a1 Add a script to correct IDs 2020-05-06 14:25:13 +02:00
a3d4
8f68c04358 Add unique IDs to error reporting calls 2020-05-06 13:53:46 +02:00
a3d4
e3641b88ec Groundwork. Prepare for automatic tagging
[Not compilable until the next commit]
2020-05-06 13:52:28 +02:00
a3d4
523460da07 Prevent coloring irrelevant whitespaces 2020-04-24 00:51:15 +02:00
a3d4
8717c073a6 Fix leftpad in SourceReferenceFormatterHuman 2020-04-24 00:34:24 +02:00
Alexander Arlt
aac7a1e434 Apply modernize-pass-by-value. 2020-04-14 10:32:13 -05:00
chriseth
f10c6500b2 Immutable is not reserved anymore. 2020-03-02 14:20:17 +01:00
Djordje Mijovic
ec083c4878 Adding source location support to AssemblyStack and thus debugging Yul sources 2020-02-25 22:19:03 +01:00
Erik Kundt
cfc70ede5c Corrects comment literal that span too long. 2020-02-14 15:53:35 +01:00
Erik Kundt
b43751d65e Reports source location for structured documentation errors. 2020-02-14 15:21:39 +01:00
chriseth
64bb0d55e0
Merge pull request #8268 from a3d4/lineatposition-crlf
Avoided trailing '\r' in CharStream::lineAtPosition().
2020-02-10 15:58:52 +01:00
a3d4
be1d92c836 Avoided trailing \r in CharStream::lineAtPosition(). 2020-02-10 01:16:55 +01:00
a3d4
b3b8441aa4 Fix printing source for missing pragma. 2020-02-09 02:28:47 +01:00
a3d4
4ec4d23886 Replaced ParserBase::position() and ParserBase::endPosition() with ParserBase::currentLocation().
It might be simpler to pass `SourceLocation` object instead of splitting it into `start` and `end`, and creating another SourceLocation object using the same `start` and `end` later.
2020-02-06 03:34:49 +01:00
alex
3416c029cf Relaxed assert in AsmJsonImporter::createAsmNode. 2020-02-04 20:37:51 +01:00
alex
211227f50b Modified SourceLocation::hasText() to allow empty source. 2020-02-04 04:19:28 +01:00
alex
76cfe4e2ce Replaced SourceLocation::isEmpty() with isValid() and hasText().
The function SourceLocation::isEmpty() had somewhat dual role.
Sometimes it indicates that the SourceLocation is invalid.
Sometimes it means that there is no corresponding source text.

Hence the proposal is to replace it with two functions, isValid() and hasText().

I also removed Scanner::sourceAt(). (Do we have a rule of thumb to remove unused code?)

Since hasText() checks that start and end are valid indices for source, I adjusted a couple of tests to avoid empty source strings.
2020-02-03 12:44:26 +01:00
Erik Kundt
ec27c2e507 Introduce AST node for structured documentation. 2020-01-30 18:25:56 +01:00
Mathias Baumann
dd035f8f48 Increase scanner lookahead to two. 2020-01-23 13:25:03 +01:00
chriseth
b3fe84a6ea
Merge pull request #7153 from djudjuu/newImportAST
import ast from JSON
2020-01-14 17:56:53 +01:00
djudjuu
e8556fa1b2 Ast-Import from standard-json 2020-01-14 17:15:53 +01:00
Christian Parpart
abb9f1eed7 CMake: Renaming devcore static library to solutil (to match source code paths) 2020-01-13 15:52:46 +01:00
Daniel Kirchner
03c70f45d6 Handle empty source strings in SourceReferenceExtractor 2020-01-09 14:18:54 +01:00
Christian Parpart
345f9928ab Library libdevcore renamed to libsolutil. 2020-01-07 15:51:50 +01:00
Christian Parpart
6b23412fae C++ namespace cleanup (except tests). 2020-01-07 15:51:50 +01:00
chriseth
f6916a637e Merge remote-tracking branch 'origin/develop' into develop_060 2019-12-09 17:16:58 +01:00
chriseth
9c3503834d Fix semver matcher differently. 2019-12-09 15:45:01 +01:00
Mathias Baumann
be615d4f2b Fix wrong construction of ElementaryTypeNameToken
And add an assert to prevent it in the future
2019-12-09 13:24:33 +00:00