Skip to content

Commit 4a7ca18

Browse files
committed
Allow (yet) undefined functions
1 parent 0cd430a commit 4a7ca18

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

main.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,12 @@ bar", 127 } }, 0 }, // Newline
566566
{ "on foo then $a = 1; end if 3 == 3 then $a = 'foo'; end", { { "[1]$a = 1", 111 }, { "[2]$a = foo", 163 } }, { { "[1]$a = 1", 111 }, { "[2]$a = foo", 202 } }, 0 },
567567
{ "if 1 == 1 then $a = 1; $b = 2; $aa = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.1; $bb = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.2; $cc = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.3; $dd = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.4; $dd = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.5; $ee = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.6; $ff = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.7; $ff = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.8; $gg = round($a / (($b * 230) + 50) * 10) / 10; end", { "[1]$a = 1[1]$b = 2.8[1]$aa = 0[1]$bb = 0[1]$cc = 0[1]$dd = 0[1]$ee = 0[1]$ff = 0[1]$gg = 0", 710 }, { "[1]$a = 1[1]$b = 2.8[1]$aa = 0[1]$bb = 0[1]$cc = 0[1]$dd = 0[1]$ee = 0[1]$ff = 0[1]$gg = 0", 710 }, 0 },
568568
{ "on foo then coalesce(10, 5); $a = 1; $b = 2; if $c == 12 && $d == 0 then $e = 1; end", { "[1]$a = 1[1]$b = 2[1]$e = 1", 263 }, { "[1]$a = 1[1]$b = 2", 263 }, 0 },
569-
570569
{ "on foo($a, $b) then print($a); $b = 1; end", { "[1]$a = NULL[1]$b = 1", 158 }, { "[1]$a = NULL[1]$b = 1", 158 }, 0 },
571570
{ "on foo then print($a); $b = 1; end", { "[1]$b = 1", 150 }, { "[1]$b = 1", 150 }, 0 },
572571
{ "on sub2($a) then print($a); $b = $a; end if 1 == 1 then print($a); sub2(2); end", { { "[1]$a = NULL[1]$b = NULL", 159 }, { "[1]$a = 2[1]$b = 2", 215 } }, { { "[1]$a = NULL[1]$b = NULL", 128 },{ "[1]$a = 2[1]$b = 2", 215 } }, 0 },
573572
{ "on sub2($a) then print($a); $c = $a + 1; end on sub1($a) then print($a); sub2($a + 1); $b = $a - 1; end if 1 == 1 then sub1(1); end", { { "[1]$a = NULL[1]$c = NULL", 167 }, { "[1]$a = NULL[1]$c = NULL[2]$a = NULL[2]$b = NULL", 271 }, { "[1]$a = 2[1]$c = 3[2]$a = 1[2]$b = 0", 271 } }, { { "[1]$a = NULL[1]$c = NULL", 128 }, { "[1]$a = NULL[1]$c = NULL[2]$a = NULL[2]$b = NULL", 196 }, { "[1]$a = 2[1]$c = 3[2]$a = 1[2]$b = 0", 196 } }, 0 },
574573
{ "if 1 == 1 then $a = 1; $b = 1; $c = 1; $d = 1; $e = 1; $f = 1; $g = 1; $h = 1; $i = 1; $j = 1; $k = 1; $l = 1; $m = 1; $n = 1; $o = 1; $p = 1; $q = 1; $r = 1; $s = 1; $t = 1; $u = 1; $v = 1; $w = 1; $x = 1; $y = 1; $z = 1; $aa = 1; $ab = 1; $ac = 1; $ad = 1; $ae = 1; $af = 1; $ag = 1; $ah = 1; $aj = 1; $aj = 1; $ak = 1; $al = 1; $am = 1; $an = 1; $ao = 1; $ap = 1; $aq = 1; $ar = 1; $as = 1; $at = 1; $au = 1; $av = 1; $aw = 1; $ax = 1; $ay = 1; $az = 1; $ba = 1; $bb = 1; $bc = 1; $bd = 1; $be = 1; $bf = 1; $bg = 1; $bh = 1; $bj = 1; $bj = 1; $bk = 1; $bl = 1; $bm = 1; $bn = 1; $bo = 1; $bp = 1; $bq = 1; $br = 1; $bs = 1; $bt = 1; $bu = 1; $bv = 1; $bw = 1; $bx = 1; $by = 1; $bz = 1; $ca = 1; $cb = 1; $cc = 1; $cd = 1; $ce = 1; $cf = 1; $cg = 1; $ch = 1; $cj = 1; $cj = 1; $ck = 1; $cl = 1; $cm = 1; $cn = 1; $co = 1; $cp = 1; $cq = 1; $cr = 1; $cs = 1; $ct = 1; $cu = 1; $cv = 1; $cw = 1; $cx = 1; $cy = 1; $cz = 1; $da = 1; $db = 1; $dc = 1; $dd = 1; $de = 1; $df = 1; $dg = 1; $dh = 1; $dj = 1; end", { { "[1]$de = 1[1]$df = 1[1]$dg = 1[1]$dh = 1[1]$dj = 1", 2706 } }, { { "[1]$de = 1[1]$df = 1[1]$dg = 1[1]$dh = 1[1]$dj = 1", 0 } }, 0 },
575-
574+
{ "on sub2 then sub1(1); end on sub1($a) then print($a); end on sub3 then sub2(); end", { { "", 126 }, { "[2]$a = NULL", 189 }, { "[2]$a = 1", 238 } }, { { "", 128 },{ "[2]$a = NULL", 215 }, { "[2]$a = 1", 238 } }, 0 },
576575

577576
/*
578577
* Invalid rules

src/rules/rules.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,6 +3246,7 @@ static int16_t rule_create(char **text, struct rules_t *obj) {
32463246
case TSEMICOLON:
32473247
case TTHEN:
32483248
case TFUNCTION:
3249+
case TEVENT:
32493250
case TVAR: {
32503251
} break;
32513252
default: {
@@ -3273,6 +3274,7 @@ static int16_t rule_create(char **text, struct rules_t *obj) {
32733274
/* LCOV_EXCL_STOP*/
32743275
}
32753276
switch(type) {
3277+
case TEVENT:
32763278
case TFUNCTION:
32773279
case LPAREN: {
32783280
go = type;

0 commit comments

Comments
 (0)