From 8e0d2759f61d61a83a362a950754120bedbf2ce1 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 26 May 2022 12:55:33 +0000 Subject: Consistency pass Signed-off-by: Laurent Bercot --- src/libexecline/PARSING.txt | 30 +++++++++++++++--------------- src/libexecline/el_parse.c | 8 ++++---- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/libexecline/PARSING.txt b/src/libexecline/PARSING.txt index b84c0ff..293d812 100644 --- a/src/libexecline/PARSING.txt +++ b/src/libexecline/PARSING.txt @@ -72,28 +72,28 @@ Q1: after a backslash in whitespace Q2: after a backslash in an unquoted word Q3: after a backslash in a quoted string Q: in a quoted string -OCT: after \0 in a quoted string -OCT1: after \0a in a quoted string -OCT2: after \0ab in a quoted string -DEC1: after \a in a quoted string -DEC2: after \ab in a quoted string -HEX: after \0x in a quoted string -HEX1: after \0xa in a quoted string -ENDNUM: after \0abc, \abc or \0xab in a quoted string +OCT: after \0 +OCT1: after \0a +OCT2: after \0ab +DEC1: after \a +DEC2: after \ab +HEX: after \0x +HEX1: after \0xa +ENDNUM: after \0abc, \abc or \0xab END: success X: syntax error Actions -8000 s scan integer from mark to cur +8000 s scan integer from mark, push it 4000 m set mark -2000 n add blevel spaces -1000 { inc blevel + unpush blevel -0800 } dec blevel + unpush 2 -0400 p add cur to word -0200 c add control char (depending on cur) to word -0100 0 end word +2000 n new word: push blevel spaces +1000 { begin block (inc blevel, unpush) +0800 } end block (dec blevel, unpush) +0400 p push cur +0200 c push control char (depending on cur) +0100 0 end word: push \0 0080 b switch base according to cur 0040 unused 0020 unused diff --git a/src/libexecline/el_parse.c b/src/libexecline/el_parse.c index 6ef7ce9..23a9df5 100644 --- a/src/libexecline/el_parse.c +++ b/src/libexecline/el_parse.c @@ -69,18 +69,18 @@ int el_parse (stralloc *sa, el_chargen_func_ref next, void *source) if (!blevel--) return -4 ; sa->len -= 2 ; } - if (c & 0x0400) if (!stralloc_catb(sa, (char *)&cur, 1)) return -1 ; - if (c & 0x0200) + if (c & 0x0400U) if (!stralloc_catb(sa, (char *)&cur, 1)) return -1 ; + if (c & 0x0200U) { char x = 7 + byte_chr("abtnvfr", 7, cur) ; if (!stralloc_catb(sa, &x, 1)) return -1 ; } - if (c & 0x0100) + if (c & 0x0100U) { if (n++ >= INT_MAX) return (errno = E2BIG, -1) ; if (!stralloc_0(sa)) return -1 ; } - if (c & 0x0080) + if (c & 0x0080U) { switch (cur) { -- cgit v1.2.3