mirror of https://github.com/sveltejs/svelte
parent
4b3cacf3b9
commit
561ecf28ff
@ -1,18 +1,20 @@
|
||||
import { Parser } from '../index';
|
||||
import { isIdentifierStart } from 'acorn';
|
||||
import full_char_code_at from '../../utils/full_char_code_at';
|
||||
import full_char_code_at from '../../utils/full_char_code_at.js';
|
||||
import {
|
||||
is_bracket_open,
|
||||
is_bracket_close,
|
||||
is_bracket_pair,
|
||||
get_bracket_close
|
||||
} from '../utils/bracket';
|
||||
import { parse_expression_at } from '../acorn';
|
||||
import { Pattern } from 'estree';
|
||||
import parser_errors from '../errors';
|
||||
import { regex_not_newline_characters } from '../../utils/patterns';
|
||||
} from '../utils/bracket.js';
|
||||
import { parse_expression_at } from '../acorn.js';
|
||||
import parser_errors from '../errors.js';
|
||||
import { regex_not_newline_characters } from '../../utils/patterns.js';
|
||||
|
||||
export default function read_context(parser: Parser): Pattern & { start: number; end: number } {
|
||||
/**
|
||||
* @param {import('../index.js').Parser} parser
|
||||
* @returns {Pattern & { start: number; end: number }}
|
||||
*/
|
||||
export default function read_context(parser) {
|
||||
const start = parser.index;
|
||||
let i = parser.index;
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
import tag from './tag.js';
|
||||
import mustache from './mustache.js';
|
||||
import text from './text.js';
|
||||
|
||||
/**
|
||||
* @param {import('../index.js').Parser} parser
|
||||
*/
|
||||
export default function fragment(parser) {
|
||||
if (parser.match('<')) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
if (parser.match('{')) {
|
||||
return mustache;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
import tag from './tag';
|
||||
import mustache from './mustache';
|
||||
import text from './text';
|
||||
import { Parser } from '../index';
|
||||
|
||||
export default function fragment(parser: Parser) {
|
||||
if (parser.match('<')) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
if (parser.match('{')) {
|
||||
return mustache;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
@ -1,7 +1,9 @@
|
||||
import { decode_character_references } from '../utils/html';
|
||||
import { Parser } from '../index';
|
||||
import { decode_character_references } from '../utils/html.js';
|
||||
|
||||
export default function text(parser: Parser) {
|
||||
/**
|
||||
* @param {import('../index.js').Parser} parser
|
||||
*/
|
||||
export default function text(parser) {
|
||||
const start = parser.index;
|
||||
|
||||
let data = '';
|
||||
@ -1,6 +1,7 @@
|
||||
import { TemplateNode } from '../../interfaces';
|
||||
|
||||
export function to_string(node: TemplateNode) {
|
||||
/**
|
||||
* @param {import("../../interfaces.js").TemplateNode} node
|
||||
*/
|
||||
export function to_string(node) {
|
||||
switch (node.type) {
|
||||
case 'IfBlock':
|
||||
return '{#if} block';
|
||||
Loading…
Reference in new issue