File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -854,7 +854,10 @@ fn parse_string_type_definition(
854
854
} ) ,
855
855
_ => Some ( DataTypeDeclaration :: DataTypeReference { referenced_type : text, location } ) ,
856
856
}
857
- . zip ( Some ( lexer. try_consume ( & KeywordAssignment ) . then ( || parse_expression ( lexer) ) ) )
857
+ . zip ( Some (
858
+ ( lexer. try_consume ( & KeywordAssignment ) || lexer. try_consume ( & KeywordReferenceAssignment ) )
859
+ . then ( || parse_expression ( lexer) ) ,
860
+ ) )
858
861
}
859
862
860
863
fn parse_enum_type_definition (
Original file line number Diff line number Diff line change @@ -291,7 +291,7 @@ fn ref_assignment() {
291
291
}
292
292
293
293
#[ test]
294
- fn reference_to_declaration ( ) {
294
+ fn reference_to_dint_declaration ( ) {
295
295
let ( result, diagnostics) = parse (
296
296
r"
297
297
FUNCTION foo
@@ -340,6 +340,42 @@ fn reference_to_declaration() {
340
340
"### ) ;
341
341
}
342
342
343
+ #[ test]
344
+ fn reference_to_string_declaration ( ) {
345
+ let ( result, diagnostics) = parse (
346
+ r"
347
+ FUNCTION foo
348
+ VAR
349
+ foo : REFERENCE TO STRING;
350
+ END_VAR
351
+ END_FUNCTION
352
+ " ,
353
+ ) ;
354
+
355
+ assert ! ( diagnostics. is_empty( ) ) ;
356
+ insta:: assert_debug_snapshot!( result. units[ 0 ] . variable_blocks[ 0 ] , @r###"
357
+ VariableBlock {
358
+ variables: [
359
+ Variable {
360
+ name: "foo",
361
+ data_type: DataTypeDefinition {
362
+ data_type: PointerType {
363
+ name: None,
364
+ referenced_type: DataTypeReference {
365
+ referenced_type: "STRING",
366
+ },
367
+ auto_deref: Some(
368
+ Reference,
369
+ ),
370
+ },
371
+ },
372
+ },
373
+ ],
374
+ variable_block_type: Local,
375
+ }
376
+ "### ) ;
377
+ }
378
+
343
379
#[ test]
344
380
fn aliasing_dint_variable ( ) {
345
381
let ( result, diagnostics) = parse (
You can’t perform that action at this time.
0 commit comments