accept_t lexer_read_literal_unquoted(struct lexer_book * bk) { int count = lexer_read_escaped_until(bk, LITERAL_LIMITS); if(count > 0) return YES; else return NO; }
/* 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; }
/* Read everything between single quotes */ int lexer_read_literal_quoted(struct lexer * lx) { int c = lexer_next_peek(lx); if(c != '\'') lexer_report_error(lx, "Missing opening quote.\n"); lexer_add_to_lexeme(lx, lexer_next_char(lx)); /* Add first ' */ int count = lexer_read_escaped_until(lx, "'"); lexer_add_to_lexeme(lx, lexer_next_char(lx)); /* Add second ' */ return count; }
/* Read everything between single quotes */ accept_t lexer_read_literal_quoted(struct lexer_book * bk) { int c = lexer_next_peek(bk); if(c != '\'') return NO; lexer_next_char(bk); /* Jump first ' */ int count = lexer_read_escaped_until(bk, "'"); if(count >= 0) { lexer_next_char(bk); /* Jump second ' */ return YES; } else return NO; }
/* 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; }
int lexer_read_literal_unquoted(struct lexer * lx) { return lexer_read_escaped_until(lx, LITERAL_LIMITS); }