diff options
author | Justus Winter <[email protected]> | 2016-12-19 14:29:07 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-12-19 14:42:35 +0000 |
commit | 3ae0b5d9af063e7af03558be2bf8f32e5bb4e5cd (patch) | |
tree | 0700c524c847b773f24eafd25a88214ecd48f464 | |
parent | gpgscm: Display location when assertions fail. (diff) | |
download | libgpg-error-3ae0b5d9af063e7af03558be2bf8f32e5bb4e5cd.tar.gz libgpg-error-3ae0b5d9af063e7af03558be2bf8f32e5bb4e5cd.zip |
gpgscm: Change associativity of ::.
* tests/gpgscm/scheme.c (mk_atom): Change associativity of the ::
infix-operator. This makes it possible to naturally express accessing
nested structures (e.g. a::b::c).
Signed-off-by: Justus Winter <[email protected]>
-rw-r--r-- | scheme.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1409,14 +1409,23 @@ static pointer mk_atom(scheme *sc, char *q) { int has_fp_exp = 0; #if USE_COLON_HOOK - if((p=strstr(q,"::"))!=0) { + char *next; + next = p = q; + while ((next = strstr(next, "::")) != 0) { + /* Keep looking for the last occurrence. */ + p = next; + next = next + 2; + } + + if (p != q) { *p=0; return cons(sc, sc->COLON_HOOK, cons(sc, cons(sc, sc->QUOTE, - cons(sc, mk_atom(sc,p+2), sc->NIL)), - cons(sc, mk_symbol(sc,strlwr(q)), sc->NIL))); + cons(sc, mk_symbol(sc, strlwr(p + 2)), + sc->NIL)), + cons(sc, mk_atom(sc, q), sc->NIL))); } #endif |