Home / Function/ read_value() — svelte Function Reference

read_value() — svelte Function Reference

Architecture documentation for the read_value() function in style.js from the svelte codebase.

Function javascript Compiler Transformer calls 1 called by 3

Entity Profile

Dependency Diagram

graph TD
  998e5052_9be5_2c73_14b0_84ce50994d42["read_value()"]
  251e2338_f8b8_69b4_b2e5_29ee7decbfa6["style.js"]
  998e5052_9be5_2c73_14b0_84ce50994d42 -->|defined in| 251e2338_f8b8_69b4_b2e5_29ee7decbfa6
  53e6c97d_9ffd_d8ad_0e88_afabeb05753a["read_at_rule()"]
  53e6c97d_9ffd_d8ad_0e88_afabeb05753a -->|calls| 998e5052_9be5_2c73_14b0_84ce50994d42
  b72c2083_31ae_feed_8216_d263cace4b10["read_block_item()"]
  b72c2083_31ae_feed_8216_d263cace4b10 -->|calls| 998e5052_9be5_2c73_14b0_84ce50994d42
  883f8dc6_d58a_da13_a1b1_889d3d0b4fa2["read_declaration()"]
  883f8dc6_d58a_da13_a1b1_889d3d0b4fa2 -->|calls| 998e5052_9be5_2c73_14b0_84ce50994d42
  feea79ed_c6f7_4068_9c81_9734e5dcbfb7["unexpected_eof()"]
  998e5052_9be5_2c73_14b0_84ce50994d42 -->|calls| feea79ed_c6f7_4068_9c81_9734e5dcbfb7
  style 998e5052_9be5_2c73_14b0_84ce50994d42 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/1-parse/read/style.js lines 497–535

function read_value(parser) {
	let value = '';
	let escaped = false;
	let in_url = false;

	/** @type {null | '"' | "'"} */
	let quote_mark = null;

	while (parser.index < parser.template.length) {
		const char = parser.template[parser.index];

		if (escaped) {
			value += '\\' + char;
			escaped = false;
			parser.index++;
			continue;
		} else if (char === '\\') {
			escaped = true;
			parser.index++;
			continue;
		} else if (char === quote_mark) {
			quote_mark = null;
		} else if (char === ')') {
			in_url = false;
		} else if (quote_mark === null && (char === '"' || char === "'")) {
			quote_mark = char;
		} else if (char === '(' && value.slice(-3) === 'url') {
			in_url = true;
		} else if ((char === ';' || char === '{' || char === '}') && !in_url && !quote_mark) {
			return value.trim();
		}

		value += char;

		parser.index++;
	}

	e.unexpected_eof(parser.template.length);
}

Domain

Subdomains

Frequently Asked Questions

What does read_value() do?
read_value() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/1-parse/read/style.js.
Where is read_value() defined?
read_value() is defined in packages/svelte/src/compiler/phases/1-parse/read/style.js at line 497.
What does read_value() call?
read_value() calls 1 function(s): unexpected_eof.
What calls read_value()?
read_value() is called by 3 function(s): read_at_rule, read_block_item, read_declaration.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free