special() — svelte Function Reference
Architecture documentation for the special() function in tag.js from the svelte codebase.
Entity Profile
Dependency Diagram
graph TD 293ea078_697f_e55b_c696_1c508cae7857["special()"] 367a364a_2912_a1aa_b2e1_d97a82783c38["tag.js"] 293ea078_697f_e55b_c696_1c508cae7857 -->|defined in| 367a364a_2912_a1aa_b2e1_d97a82783c38 e584f5ba_af7a_4d95_57a7_8a4e31da0ab8["tag()"] e584f5ba_af7a_4d95_57a7_8a4e31da0ab8 -->|calls| 293ea078_697f_e55b_c696_1c508cae7857 f55653bc_77b3_5212_03f1_93bc274916e8["read_expression()"] 293ea078_697f_e55b_c696_1c508cae7857 -->|calls| f55653bc_77b3_5212_03f1_93bc274916e8 19548378_e461_9127_58e8_d56666b59619["debug_tag_invalid_arguments()"] 293ea078_697f_e55b_c696_1c508cae7857 -->|calls| 19548378_e461_9127_58e8_d56666b59619 6a786ac5_79fd_078b_6df2_8e1e4a370161["read_pattern()"] 293ea078_697f_e55b_c696_1c508cae7857 -->|calls| 6a786ac5_79fd_078b_6df2_8e1e4a370161 c1b6aa2d_e1a3_5a07_0b4e_e3cf86a53661["const_tag_invalid_expression()"] 293ea078_697f_e55b_c696_1c508cae7857 -->|calls| c1b6aa2d_e1a3_5a07_0b4e_e3cf86a53661 44818481_1583_eeb9_4c3a_f1bc6e2c2579["render_tag_invalid_expression()"] 293ea078_697f_e55b_c696_1c508cae7857 -->|calls| 44818481_1583_eeb9_4c3a_f1bc6e2c2579 784480d0_767d_ac40_b03e_ae8ddcc82684["Set()"] 293ea078_697f_e55b_c696_1c508cae7857 -->|calls| 784480d0_767d_ac40_b03e_ae8ddcc82684 30d2edb9_b94d_abce_8f98_db1f87ac28a4["expected_tag()"] 293ea078_697f_e55b_c696_1c508cae7857 -->|calls| 30d2edb9_b94d_abce_8f98_db1f87ac28a4 style 293ea078_697f_e55b_c696_1c508cae7857 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/svelte/src/compiler/phases/1-parse/state/tag.js lines 616–751
function special(parser) {
let start = parser.index;
while (parser.template[start] !== '{') start -= 1;
if (parser.eat('html')) {
// {@html content} tag
parser.require_whitespace();
const expression = read_expression(parser);
parser.allow_whitespace();
parser.eat('}', true);
parser.append({
type: 'HtmlTag',
start,
end: parser.index,
expression,
metadata: {
expression: new ExpressionMetadata()
}
});
return;
}
if (parser.eat('debug')) {
/** @type {Identifier[]} */
let identifiers;
// Implies {@debug} which indicates "debug all"
if (parser.read(regex_whitespace_with_closing_curly_brace)) {
identifiers = [];
} else {
const expression = read_expression(parser);
identifiers =
expression.type === 'SequenceExpression'
? /** @type {Identifier[]} */ (expression.expressions)
: [/** @type {Identifier} */ (expression)];
identifiers.forEach(
/** @param {any} node */ (node) => {
if (node.type !== 'Identifier') {
e.debug_tag_invalid_arguments(/** @type {number} */ (node.start));
}
}
);
parser.allow_whitespace();
parser.eat('}', true);
}
parser.append({
type: 'DebugTag',
start,
end: parser.index,
identifiers
});
return;
}
if (parser.eat('const')) {
parser.require_whitespace();
const id = read_pattern(parser);
parser.allow_whitespace();
parser.eat('=', true);
parser.allow_whitespace();
const expression_start = parser.index;
const init = read_expression(parser);
if (
init.type === 'SequenceExpression' &&
!parser.template.substring(expression_start, init.start).includes('(')
) {
// const a = (b, c) is allowed but a = b, c = d is not;
e.const_tag_invalid_expression(init);
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does special() do?
special() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/1-parse/state/tag.js.
Where is special() defined?
special() is defined in packages/svelte/src/compiler/phases/1-parse/state/tag.js at line 616.
What does special() call?
special() calls 7 function(s): Set, const_tag_invalid_expression, debug_tag_invalid_arguments, expected_tag, read_expression, read_pattern, render_tag_invalid_expression.
What calls special()?
special() is called by 1 function(s): tag.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free