mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Scanner: Generate error on inbalanced RLO/LRO/PDF override markers.
This commit is contained in:
committed by
chriseth
parent
67b7267735
commit
381c63ec99
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// PDF
|
||||
/*underflow */
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (71-83): Unicode direction override underflow in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// PDF PDF
|
||||
/*underflow */
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (75-87): Unicode direction override underflow in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// RLO
|
||||
/*overflow */
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (71-86): Mismatching directional override markers in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// RLO RLO
|
||||
/*overflow */
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (75-93): Mismatching directional override markers in comment or string literal.
|
||||
@@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// RLO PDF
|
||||
/*ok */
|
||||
|
||||
// RLO RLO PDF PDF
|
||||
/*ok */
|
||||
|
||||
// RLO RLO RLO PDF PDF PDF
|
||||
/*ok */
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// PDF RLO
|
||||
/*overflow */
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (75-86): Unicode direction override underflow in comment or string literal.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
/* LRO LRE RLE PDF RLO PDF PDF
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (52-115): Expected multi-line comment-terminator.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// PDF
|
||||
// underflow
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (71-84): Unicode direction override underflow in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// PDF PDF
|
||||
// underflow
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (75-88): Unicode direction override underflow in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// RLO
|
||||
// overflow
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (71-86): Mismatching directional override markers in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// RLO RLO
|
||||
// overflow
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (75-93): Mismatching directional override markers in comment or string literal.
|
||||
@@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// RLO PDF
|
||||
// ok
|
||||
|
||||
// RLO RLO PDF PDF
|
||||
// ok
|
||||
|
||||
// RLO RLO RLO PDF PDF PDF
|
||||
// ok
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// PDF RLO
|
||||
// underflow
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (75-88): Unicode direction override underflow in comment or string literal.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f(bool b) public pure
|
||||
{
|
||||
if (b) { return; }
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (65-66): Expected '(' but got 'ILLEGAL'
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f(bool b) public pure
|
||||
{
|
||||
uint a = 10;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (75-76): Invalid token.
|
||||
@@ -0,0 +1,10 @@
|
||||
contract TimelockUpgrade {
|
||||
function confirmUpgrade() external {
|
||||
uint256 m;
|
||||
uint256 d;
|
||||
(/*year*/,/*month*/,d/*yad*/,m/*hour*/,/*minute*/,/*second*/) = BokkyDateTime.timestampToDateTime(block.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// ParserError 8936: (128-139): Mismatching directional override markers in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// PDF
|
||||
bytes memory s = unicode"underflow ";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (88-106): Unicode direction override underflow in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// PDF PDF
|
||||
bytes memory m = unicode"underflow ";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (92-110): Unicode direction override underflow in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// RLO
|
||||
bytes memory m = unicode"overflow ";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (88-108): Mismatching directional override markers in comment or string literal.
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// RLO RLO
|
||||
bytes memory m = unicode"overflow ";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (92-115): Mismatching directional override markers in comment or string literal.
|
||||
@@ -0,0 +1,14 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// RLO PDF
|
||||
bytes memory m = unicode" ok ";
|
||||
|
||||
// RLO RLO PDF PDF
|
||||
m = unicode" ok ";
|
||||
|
||||
// RLO RLO RLO PDF PDF PDF
|
||||
m = unicode" ok ";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// PDF RLO
|
||||
bytes memory m = unicode" underflow ";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 8936: (92-111): Unicode direction override underflow in comment or string literal.
|
||||
@@ -0,0 +1,13 @@
|
||||
contract C {
|
||||
function f() public pure
|
||||
{
|
||||
// LRO PDF RLO PDF
|
||||
bytes memory m = unicode" ok ";
|
||||
|
||||
// lre rle pdf pdf
|
||||
m = unicode"lre rle pdf pdf";
|
||||
// lre lro pdf pdf
|
||||
m = unicode"lre lro pdf pdf";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
Reference in New Issue
Block a user