• Poul-Henning Kamp's avatar
    Rewrite of the "if (foo)" code in VCC to actually build expressions · 9299780d
    Poul-Henning Kamp authored
    the way we learned to do it back in the 1950'ies.
    
    Until now, VCC has used sort of a massaged C-expression and with
    the introduction of things like regexp matching and ACLs that turned
    sort of ugly.
    
    This code is classic recursive expression parsing with a couple of
    twists:
    
    1. We don't build a tree, because we are not going to optimize stuff,
       we leave that to the C compiler.
    
    2. Instead of the tree we build a string with magic markers that
       let us get the indentation of the produced C code right anyway.
    
    3. We do type-hinted parsing, in an attempt to produce intelligent
       error messages and sensible semantics.
    
    This code passes all testcases with a single change:  We can now
    compile "if (2 == 3)".  This is probably a good thing (?)
    
    Beware of bugs...
    
    
    
    
    git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5130 d4fa192b-c00b-0410-8231-f00ffab90ce4
    9299780d
vcc_acl.c 11.4 KB