Commit graph

19 commits

Author SHA1 Message Date
Vern Paxson
e5bb63c662 fixes & enhancements to location information associated w/ AST nodes & ZAM optimization 2024-02-06 11:03:02 +01:00
Vern Paxson
087eb1ca4e new method for Stmt nodes to report whether they could execute a "return" 2023-12-04 16:53:32 -08:00
Benjamin Bannier
f5a76c1aed Reformat Zeek in Spicy style
This largely copies over Spicy's `.clang-format` configuration file. The
one place where we deviate is header include order since Zeek depends on
headers being included in a certain order.
2023-10-30 09:40:55 +01:00
Vern Paxson
79c53c9ed6 some code simplifications and streamlining 2023-07-20 09:35:07 -07:00
Arne Welzel
25ea678626 Stmt: Introduce assert statement and related hooks
including two hooks called assertion_failure() and assertion_result() for
customization and tracking of assertion results.
2023-06-12 18:16:02 +02:00
Arne Welzel
171846a37a parse.y/directives: Reject directives as statements
Avoid the issue outlined in #2289 where the @if or @else is taken as the
statement of an `if`, `for` or `while` by rejecting such constructs.

Effectively this means the following scripts are now rejected:

    # Print's "cond true" with Zeek 5.0 even though the `if ( F )`
    # should be in effect.

    if ( F )
        @if ( T )
            print "cond true";
        @else
            print "cond false";
        @endif

or

    # Print's "hello" once with Zeek 5.0
    local v = vector( 1, 2, 3 );

    for ( i in v )
        @if ( T )
        print("hello")
        @endif

To make above work as intended, additional braces can be used.

    if ( T )
        {
    @if ( cond )
            print "cond true";
    @else
            print "cond false";
    @endif
        }

    for ( i in v )
        {
    @if ( T )
        print("hello")
    @endif
        }
2022-08-26 09:42:50 +02:00
Vern Paxson
7d00ce0082 speed up ZAM compilation by capping function size when inlining 2022-05-14 14:52:31 -07:00
Tim Wojtulewicz
b2f171ec69 Reformat the world 2021-09-16 15:35:39 -07:00
Vern Paxson
3ac725f44b tracking of optimization information associated with statements 2021-09-08 10:23:38 -07:00
Vern Paxson
01bf4b8484 making Exec methods non-const, so execution can manage side-information 2021-03-18 08:22:55 -07:00
Tim Wojtulewicz
4ad08172d0 Remove obsolete ZEEK_FORWARD_DECLARE_NAMESPACED macros 2021-02-24 14:35:44 -07:00
Jon Siwek
cfe29c2488 Merge branch 'master' into topic/vern/reaching-defs 2021-02-01 17:27:37 -08:00
Tim Wojtulewicz
0618be792f Remove all of the random single-file deprecations
These are the changes that don't require a ton of changes to other files outside
of the original removal.
2021-01-27 10:52:40 -07:00
Vern Paxson
c380a2a61a accessors and converters for Stmt subclasses 2021-01-23 10:33:30 -08:00
Jon Siwek
177b723a60 Switch some Stmt transform/reduce logic to use IntrusivePtr 2021-01-13 22:57:48 -08:00
Vern Paxson
10e80dfcd3 reductions of expressions in ASTs - code compiles but doesn't yet link 2021-01-10 14:04:01 -08:00
Vern Paxson
eb1848c547 cleaner approach for localizing errors associated with duplicated ASTs: virtualize GetLocationInfo 2021-01-07 15:14:22 -08:00
Jon Siwek
a0552f9771 Insert contents of #included script-opt files directly
Otherwise there is a functional problem caused by using #include to
insert the disconnected source code: language server/analysis tools,
like clangd, may get confused by those files and report everything
in them as an error.
2020-12-13 14:43:00 -08:00
Vern Paxson
c42586af2c inlining of Zeek script functions 2020-11-19 16:16:59 -08:00