as: Add ahead() - scc - simple c99 compiler
 (HTM) git clone git://git.simple-cc.org/scc
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 34ac4d9aeeace5c62f6e08195da7bf9fa7e0b17a
 (DIR) parent 4a43d3a6ce5978d490c58ae2a5e15fc186961d12
 (HTM) Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
       Date:   Sat, 10 Feb 2024 23:30:02 +0100
       
       as: Add ahead()
       
       The ahead() function returns the next non blank
       character and it can be used to perform one char
       read ahead and take decisions in the next character
       after the current token.
       
       Diffstat:
         M src/cmd/as/as.h                     |       1 +
         M src/cmd/as/parser.c                 |      11 +++++++++++
       
       2 files changed, 12 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/as/as.h b/src/cmd/as/as.h
       @@ -184,6 +184,7 @@ extern Node *getreg(void);
        extern Node *operand(char **s);
        extern void addinput(char *fname);
        extern int delinput(void);
       +extern int ahead(void);
        
        /* expr.c */
        extern Node *expr(void);
 (DIR) diff --git a/src/cmd/as/parser.c b/src/cmd/as/parser.c
       @@ -167,6 +167,17 @@ operator(void)
        }
        
        int
       +ahead(void)
       +{
       +        while (isspace(*textp))
       +                ++textp;
       +
       +        if (*textp != '\0')
       +                return *textp;
       +        return EOS;
       +}
       +
       +int
        next(void)
        {
                int c;