next() — svelte Function Reference
Architecture documentation for the next() function in tag.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 563ea552_7fa4_4834_a19f_2b256bff987c["next()"] 367a364a_2912_a1aa_b2e1_d97a82783c38["tag.js"] 563ea552_7fa4_4834_a19f_2b256bff987c -->|defined in| 367a364a_2912_a1aa_b2e1_d97a82783c38 e584f5ba_af7a_4d95_57a7_8a4e31da0ab8["tag()"] e584f5ba_af7a_4d95_57a7_8a4e31da0ab8 -->|calls| 563ea552_7fa4_4834_a19f_2b256bff987c f9386464_dab0_7aa2_cfd0_969e973dc903["open()"] f9386464_dab0_7aa2_cfd0_969e973dc903 -->|calls| 563ea552_7fa4_4834_a19f_2b256bff987c 7cef41bd_b7cf_112a_875e_5ca7e892c65e["expected_token()"] 563ea552_7fa4_4834_a19f_2b256bff987c -->|calls| 7cef41bd_b7cf_112a_875e_5ca7e892c65e a9ba454c_7cda_3b98_e7d6_235e83a4730b["block_invalid_elseif()"] 563ea552_7fa4_4834_a19f_2b256bff987c -->|calls| a9ba454c_7cda_3b98_e7d6_235e83a4730b ba32e941_2eb9_1bb2_8ee0_1eca52813eb8["create_fragment()"] 563ea552_7fa4_4834_a19f_2b256bff987c -->|calls| ba32e941_2eb9_1bb2_8ee0_1eca52813eb8 f55653bc_77b3_5212_03f1_93bc274916e8["read_expression()"] 563ea552_7fa4_4834_a19f_2b256bff987c -->|calls| f55653bc_77b3_5212_03f1_93bc274916e8 1ab27095_1c29_40e1_1734_b1a2174e07b4["block_duplicate_clause()"] 563ea552_7fa4_4834_a19f_2b256bff987c -->|calls| 1ab27095_1c29_40e1_1734_b1a2174e07b4 6a786ac5_79fd_078b_6df2_8e1e4a370161["read_pattern()"] 563ea552_7fa4_4834_a19f_2b256bff987c -->|calls| 6a786ac5_79fd_078b_6df2_8e1e4a370161 b22db3a3_93fa_6cf9_1051_2a31bb623e94["block_invalid_continuation_placement()"] 563ea552_7fa4_4834_a19f_2b256bff987c -->|calls| b22db3a3_93fa_6cf9_1051_2a31bb623e94 style 563ea552_7fa4_4834_a19f_2b256bff987c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/1-parse/state/tag.js lines 431–542
function next(parser) {
const start = parser.index - 1;
const block = parser.current(); // TODO type should not be TemplateNode, that's much too broad
if (block.type === 'IfBlock') {
if (!parser.eat('else')) e.expected_token(start, '{:else} or {:else if}');
if (parser.eat('if')) e.block_invalid_elseif(start);
parser.allow_whitespace();
parser.fragments.pop();
block.alternate = create_fragment();
parser.fragments.push(block.alternate);
// :else if
if (parser.eat('if')) {
parser.require_whitespace();
const expression = read_expression(parser);
parser.allow_whitespace();
parser.eat('}', true);
let elseif_start = start - 1;
while (parser.template[elseif_start] !== '{') elseif_start -= 1;
/** @type {AST.IfBlock} */
const child = parser.append({
start: elseif_start,
end: -1,
type: 'IfBlock',
elseif: true,
test: expression,
consequent: create_fragment(),
alternate: null,
metadata: {
expression: new ExpressionMetadata()
}
});
parser.stack.push(child);
parser.fragments.pop();
parser.fragments.push(child.consequent);
} else {
// :else
parser.allow_whitespace();
parser.eat('}', true);
}
return;
}
if (block.type === 'EachBlock') {
if (!parser.eat('else')) e.expected_token(start, '{:else}');
parser.allow_whitespace();
parser.eat('}', true);
block.fallback = create_fragment();
parser.fragments.pop();
parser.fragments.push(block.fallback);
return;
}
if (block.type === 'AwaitBlock') {
if (parser.eat('then')) {
if (block.then) {
e.block_duplicate_clause(start, '{:then}');
}
if (!parser.eat('}')) {
parser.require_whitespace();
block.value = read_pattern(parser);
parser.allow_whitespace();
parser.eat('}', true);
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does next() do?
next() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/1-parse/state/tag.js.
Where is next() defined?
next() is defined in packages/svelte/src/compiler/phases/1-parse/state/tag.js at line 431.
What does next() call?
next() calls 7 function(s): block_duplicate_clause, block_invalid_continuation_placement, block_invalid_elseif, create_fragment, expected_token, read_expression, read_pattern.
What calls next()?
next() is called by 2 function(s): open, tag.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free