File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,6 +61,18 @@ module Unified {
6161 override string getAPrimaryQlClass ( ) { result = "Token" }
6262 }
6363
64+ /** A trivia token, such as a comment, preserved from the original parse tree. */
65+ class TriviaToken extends @unified_trivia_token, AstNode {
66+ /** Gets the source text of this trivia token. */
67+ final string getValue ( ) { unified_trivia_tokeninfo ( this , _, result ) }
68+
69+ /** Gets a string representation of this element. */
70+ final override string toString ( ) { result = this .getValue ( ) }
71+
72+ /** Gets the name of the primary QL class for this element. */
73+ override string getAPrimaryQlClass ( ) { result = "TriviaToken" }
74+ }
75+
6476 /** Gets the file containing the given `node`. */
6577 private @file getNodeFile ( @unified_ast_node node ) {
6678 exists ( @location_default loc | unified_ast_node_location ( node , loc ) |
Original file line number Diff line number Diff line change @@ -334,7 +334,13 @@ case @unified_token.kind of
334334;
335335
336336
337- @unified_ast_node = @unified_apply_pattern | @unified_binary_expr | @unified_block_stmt | @unified_call_expr | @unified_expr_condition | @unified_expr_stmt | @unified_guard_if_stmt | @unified_if_stmt | @unified_lambda_expr | @unified_let_pattern_condition | @unified_member_access_expr | @unified_name_expr | @unified_parameter | @unified_sequence_condition | @unified_token | @unified_top_level | @unified_tuple_pattern | @unified_unary_expr | @unified_var_pattern | @unified_variable_declaration_stmt | @unified_variable_declarator
337+ unified_trivia_tokeninfo(
338+ unique int id: @unified_trivia_token,
339+ int kind: int ref,
340+ string value: string ref
341+ );
342+
343+ @unified_ast_node = @unified_apply_pattern | @unified_binary_expr | @unified_block_stmt | @unified_call_expr | @unified_expr_condition | @unified_expr_stmt | @unified_guard_if_stmt | @unified_if_stmt | @unified_lambda_expr | @unified_let_pattern_condition | @unified_member_access_expr | @unified_name_expr | @unified_parameter | @unified_sequence_condition | @unified_token | @unified_top_level | @unified_trivia_token | @unified_tuple_pattern | @unified_unary_expr | @unified_var_pattern | @unified_variable_declaration_stmt | @unified_variable_declarator
338344
339345unified_ast_node_location(
340346 unique int node: @unified_ast_node ref,
You can’t perform that action at this time.
0 commit comments