Home / Function/ read_identifier() — svelte Function Reference

read_identifier() — svelte Function Reference

Architecture documentation for the read_identifier() function in index.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  f1ad3daf_8116_e789_0965_794a1b45544d["read_identifier()"]
  042e583c_5e12_9bde_ddd8_8091d5ea0f7d["Parser"]
  f1ad3daf_8116_e789_0965_794a1b45544d -->|defined in| 042e583c_5e12_9bde_ddd8_8091d5ea0f7d
  a53788f3_4288_6c23_bd50_e754a22ca567["is_reserved()"]
  f1ad3daf_8116_e789_0965_794a1b45544d -->|calls| a53788f3_4288_6c23_bd50_e754a22ca567
  dfda6bb1_91f2_95c0_15a0_9c7c52304027["unexpected_reserved_word()"]
  f1ad3daf_8116_e789_0965_794a1b45544d -->|calls| dfda6bb1_91f2_95c0_15a0_9c7c52304027
  style f1ad3daf_8116_e789_0965_794a1b45544d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/compiler/phases/1-parse/index.js lines 227–263

	read_identifier() {
		const start = this.index;
		let end = start;
		let name = '';

		const code = /** @type {number} */ (this.template.codePointAt(this.index));

		if (isIdentifierStart(code, true)) {
			let i = this.index;
			end += code <= 0xffff ? 1 : 2;

			while (end < this.template.length) {
				const code = /** @type {number} */ (this.template.codePointAt(end));

				if (!isIdentifierChar(code, true)) break;
				end += code <= 0xffff ? 1 : 2;
			}

			name = this.template.slice(start, end);
			this.index = end;

			if (is_reserved(name)) {
				e.unexpected_reserved_word(start, name);
			}
		}

		return {
			type: 'Identifier',
			name,
			start,
			end,
			loc: {
				start: state.locator(start),
				end: state.locator(end)
			}
		};
	}

Domain

Subdomains

Frequently Asked Questions

What does read_identifier() do?
read_identifier() is a function in the svelte codebase, defined in packages/svelte/src/compiler/phases/1-parse/index.js.
Where is read_identifier() defined?
read_identifier() is defined in packages/svelte/src/compiler/phases/1-parse/index.js at line 227.
What does read_identifier() call?
read_identifier() calls 2 function(s): is_reserved, unexpected_reserved_word.

Analyze Your Own Codebase

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

Try Supermodel Free