swc_ecma_regexp/parser/reader/string_literal_parser/
ast.rs

1use swc_common::Span;
2
3#[derive(Debug)]
4pub struct StringLiteral {
5    #[allow(unused, clippy::allow_attributes)]
6    pub span: Span,
7    #[allow(unused, clippy::allow_attributes)]
8    pub kind: StringLiteralKind,
9    pub body: Vec<CodePoint>,
10}
11
12#[derive(Debug, Clone, Copy, PartialEq, Eq)]
13pub enum StringLiteralKind {
14    Double,
15    Single,
16}
17
18/// Represents UTF-16 code unit(u16 as u32) or Unicode code point(char as u32).
19/// `Span` width may be more than 1, since there will be escape sequences.
20#[derive(Debug, Clone, Copy)]
21pub struct CodePoint {
22    pub span: Span,
23    // NOTE: If we need codegen, more information should be added.
24    pub value: u32,
25}