You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
471 B
20 lines
471 B
2 years ago
|
import { String as StringToken } from '../../tokenizer/index.js';
|
||
|
import { decode, encode } from '../../utils/string.js';
|
||
|
|
||
|
export const name = 'String';
|
||
|
export const structure = {
|
||
|
value: String
|
||
|
};
|
||
|
|
||
|
export function parse() {
|
||
|
return {
|
||
|
type: 'String',
|
||
|
loc: this.getLocation(this.tokenStart, this.tokenEnd),
|
||
|
value: decode(this.consume(StringToken))
|
||
|
};
|
||
|
}
|
||
|
|
||
|
export function generate(node) {
|
||
|
this.token(StringToken, encode(node.value));
|
||
|
}
|