Files
rspade_system/node_modules/@jqhtml/parser/dist/lexer.d.ts
2025-12-12 03:00:48 +00:00

123 lines
3.6 KiB
TypeScript

export declare enum TokenType {
TEXT = "TEXT",
EXPRESSION_START = "EXPRESSION_START",// <%=
EXPRESSION_UNESCAPED = "EXPRESSION_UNESCAPED",// <%!=
CODE_START = "CODE_START",// <%
TAG_END = "TAG_END",// %>
COMMENT = "COMMENT",// <%-- comment --%>
DEFINE_START = "DEFINE_START",// <Define:
DEFINE_END = "DEFINE_END",// </Define:
COMPONENT_NAME = "COMPONENT_NAME",
SLOT_START = "SLOT_START",// <Slot:
SLOT_END = "SLOT_END",// </Slot:
SLOT_NAME = "SLOT_NAME",
TAG_OPEN = "TAG_OPEN",// <tagname or <ComponentName
TAG_CLOSE = "TAG_CLOSE",// </tagname or </ComponentName
TAG_NAME = "TAG_NAME",// The tag/component name
SELF_CLOSING = "SELF_CLOSING",// />
ATTR_NAME = "ATTR_NAME",// $property or regular
ATTR_VALUE = "ATTR_VALUE",
COLON = "COLON",
SEMICOLON = "SEMICOLON",
GT = "GT",// >
LT = "LT",// <
SLASH = "SLASH",// /
EQUALS = "EQUALS",// =
QUOTE = "QUOTE",// " or '
EOF = "EOF",
NEWLINE = "NEWLINE",
WHITESPACE = "WHITESPACE",
JAVASCRIPT = "JAVASCRIPT"
}
export interface SourceLocation {
start: {
line: number;
column: number;
offset: number;
};
end: {
line: number;
column: number;
offset: number;
};
}
export interface Token {
type: TokenType;
value: string;
line: number;
column: number;
start: number;
end: number;
loc?: SourceLocation;
}
export declare class Lexer {
private input;
private position;
private line;
private column;
private tokens;
private savedPosition;
constructor(input: string);
/**
* Save current position for later token creation
*/
private savePosition;
/**
* Get saved position or current position
*/
private getSavedPosition;
/**
* Replace <%-- comment --%> with equivalent number of newlines
* This ensures line mapping stays accurate while removing comment content
*/
private preprocessComments;
/**
* Replace HTML comments (<!-- -->) that appear OUTSIDE of <Define> tags
* This strips documentation comments before component definitions
* HTML comments INSIDE <Define> tags are preserved in the output
*/
private preprocessHTMLComments;
/**
* Preprocess code blocks and expressions
* - Insert comment markers for empty lines in code blocks
* - Collapse multi-line expressions to single line with trailing newlines
* This ensures 1:1 line mapping in generated code
*/
private preprocessCodeBlocks;
/**
* Find the closing %> tag, properly handling strings and comments
*/
private findClosingTag;
tokenize(): Token[];
private scan_next;
private scan_text;
private scan_code_block;
private scan_comment;
private scan_html_comment;
private scan_expression;
private scan_javascript;
private scan_component_name;
private scan_slot_name;
private match_sequence;
private match_keyword;
private peek_sequence;
private peek_sequence_at;
private skip_whitespace;
private current_char;
private peek_ahead;
private advance;
private add_token;
private is_tag_name_char;
private is_tag_name_continue_char;
private scan_opening_tag;
private scan_closing_tag;
private scan_attributes;
private is_attribute_start_char;
private scan_attribute;
private scan_attribute_value;
private validate_unquoted_value;
private get_current_attribute_context;
private value_contains_interpolation;
private scan_interpolated_attribute_value;
}
//# sourceMappingURL=lexer.d.ts.map