Ejemplo n.º 1
0
struct token *lexer_read_filename(struct lexer_book *bk)
{
    int count = lexer_read_filename_recursive(bk);

    if(count < 1)
        lexer_report_error(bk, "Expecting a filename.");

    return lexer_pack_token(bk, LITERAL);
}
Ejemplo n.º 2
0
struct token *lexer_read_filename(struct lexer *lx)
{
	int count = lexer_read_filename_recursive(lx);

	if(count < 1)
		lexer_report_error(lx, "Expecting a filename.");

	return lexer_pack_token(lx, TOKEN_LITERAL);
}
Ejemplo n.º 3
0
/* Read a filename, adding '-' to names when - is not followed by
   >. The 'recursive' comes because the function calls itself when
   completing a name when it added a -. */
int lexer_read_filename_recursive(struct lexer_book *bk)
{
    int count = lexer_read_escaped_until(bk, FILENAME_LIMITS);

    if(count < 1)
        return count;

    if(lexer_next_peek(bk) == '-' && !lexer_peek_remote_rename_syntax(bk)) {
        lexer_add_to_lexeme(bk, '-');
        count++;
        count += lexer_read_filename_recursive(bk);
    }

    return count;
}
Ejemplo n.º 4
0
/* Read a filename, adding '-' to names when - is not followed by
   >. The 'recursive' comes because the function calls itself when
   completing a name when it added a -. */
int lexer_read_filename_recursive(struct lexer *lx)
{
	int count = lexer_read_escaped_until(lx, FILENAME_LIMITS);

	if(count < 1)
		return count;

	if(lexer_next_peek(lx) == '-' && !lexer_peek_remote_rename_syntax(lx)) {
		lexer_add_to_lexeme(lx, '-');
		lexer_next_char(lx);
		count++;
		count += lexer_read_filename_recursive(lx);
	}

	return count;
}