split heredoc handling in the scanner
This commit is contained in:
parent
8be7417a61
commit
7e1e51e90b
30 changed files with 663 additions and 416 deletions
|
|
@ -6,21 +6,21 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/01 15:06:56 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/09/01 15:08:47 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/09/01 19:28:24 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "parser/inner/scanner.h"
|
||||
#include "parser/inner/heredoc.h"
|
||||
#include "me/types.h"
|
||||
#include "parser/array.h"
|
||||
#include "parser/inner/heredoc.h"
|
||||
#include "parser/inner/scanner.h"
|
||||
#include "parser/parser.h"
|
||||
|
||||
t_error serialize_heredocs(t_scanner *scanner, t_u8* buffer, t_u32 *size, t_usize i)
|
||||
t_error serialize_heredocs(t_scanner *scanner, t_u8 *buffer, t_u32 *size, t_usize i)
|
||||
{
|
||||
t_heredoc *heredoc;
|
||||
|
||||
heredoc = array_get(&scanner->heredocs, i);
|
||||
heredoc = vec_heredoc_get(&scanner->heredocs, i);
|
||||
if (heredoc->delimiter.len + 1 + sizeof(t_usize) + (*size) >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE)
|
||||
return (ERROR);
|
||||
buffer[(*size)++] = (char)heredoc->is_raw;
|
||||
|
|
@ -40,17 +40,17 @@ t_error serialize_heredocs(t_scanner *scanner, t_u8* buffer, t_u32 *size, t_usiz
|
|||
|
||||
t_u32 tree_sitter_sh_external_scanner_serialize(t_scanner *scanner, t_u8 *buffer)
|
||||
{
|
||||
t_u32 size;
|
||||
t_usize i;
|
||||
t_u32 size;
|
||||
t_usize i;
|
||||
|
||||
size = 0;
|
||||
buffer[size++] = (char)scanner->last_glob_paren_depth;
|
||||
buffer[size++] = (char)scanner->ext_was_in_double_quote;
|
||||
buffer[size++] = (char)scanner->ext_saw_outside_quote;
|
||||
buffer[size++] = (char)scanner->heredocs.size;
|
||||
buffer[size++] = (char)scanner->heredocs.len;
|
||||
i = 0;
|
||||
while (i < scanner->heredocs.size)
|
||||
while (i < scanner->heredocs.len)
|
||||
if (serialize_heredocs(scanner, buffer, &size, i++))
|
||||
return (0);
|
||||
return (size);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue