struct substring s = lex_tokss (lexer);
struct string_lexer slex;
- string_lexer_init (&slex, s.string, s.length, SEG_MODE_INTERACTIVE);
+ string_lexer_init (&slex, s.string, s.length, SEG_MODE_INTERACTIVE, true);
struct token another_token = { .type = T_STOP };
if (!string_lexer_next (&slex, token)
|| string_lexer_next (&slex, &another_token))
int i;
i = 0;
- string_lexer_init (&slex, s, strlen (s), SEG_MODE_INTERACTIVE);
+ string_lexer_init (&slex, s, strlen (s), SEG_MODE_INTERACTIVE, true);
while (string_lexer_next (&slex, &token))
if (token.type != SCAN_SKIP)
{
unquote_string (const char *s, struct string *content)
{
struct string_lexer slex;
- string_lexer_init (&slex, s, strlen (s), SEG_MODE_INTERACTIVE /* XXX */);
+ string_lexer_init (&slex, s, strlen (s), SEG_MODE_INTERACTIVE /* XXX */,
+ true);
struct token token1;
if (!string_lexer_next (&slex, &token1))
INPUT must not be modified or freed while SLEX is still in use. */
void
string_lexer_init (struct string_lexer *slex, const char *input, size_t length,
- enum segmenter_mode mode)
+ enum segmenter_mode mode, bool is_snippet)
{
*slex = (struct string_lexer) {
.input = input,
.length = length,
.offset = 0,
- .segmenter = segmenter_init (mode, true),
+ .segmenter = segmenter_init (mode, is_snippet),
};
}
};
void string_lexer_init (struct string_lexer *, const char *input,
- size_t length, enum segmenter_mode);
+ size_t length, enum segmenter_mode, bool is_snippet);
bool string_lexer_next (struct string_lexer *, struct token *);
#endif /* scan.h */
length--;
}
- string_lexer_init (&slex, input, length, mode);
+ string_lexer_init (&slex, input, length, mode, false);
do
{
struct token token;