Пример #1
0
void mu_token()  /* -- start len */
{
    char *last;

    DUP;   /* we'll be setting TOP when we're done */

    /* Skip leading whitespace */
    for (; first < source.end && isspace(*first); first++)
        ;

    /*
     * Scan for trailing whitespace and consume it, unless we run out of
     * input text first.
     */
    for (last = first; last < source.end; last++)
        if (isspace(*last))
        {
            /* found trailing whitespace; consume it */
            mu_return_token(last, 1);
            return;
        }

    /* ran out of text; don't consume trailing */
    mu_return_token(last, 0);
}
Пример #2
0
void mu_parse()  /* delim -- start len */
{
    char *last;

    /* The first character of unseen input is the first character of token. */

    /*
     * Scan for trailing delimiter and consume it, unless we run out of
     * input text first.
     */
    for (last = first; last < source.end; last++)
        if (TOP == *last)
        {
            /* found trailing delimiter; consume it */
            mu_return_token(last, 1);
            return;
        }

    /* ran out of text; don't consume trailing */
    mu_return_token(last, 0);
}
Пример #3
0
/*
 * Scan for trailing delimiter and consume it, unless we run out of
 * input text first.
 */
static void mu_scan(int delim)
{
    char *last;

    /* capture lineno that token begins on */
    parsed_lineno = lineno;

    for (last = first; last < end; last++)
    {
        if (*last == '\n') lineno++;
        if (delim == *last
            || (delim == ' ' && isspace(*last)))
        {
            /* found trailing delimiter; consume it */
            mu_return_token(last, 1);
            return;
        }
    }

    /* ran out of text; don't consume trailing */
    mu_return_token(last, 0);
}