Skip to content

Commit 1406d38

Browse files
authored
fix: Match Option value when parsing alias variables (#1266)
Fixes an issue where omitting a data-type in an alias variable would cause a panic in the parser. For example ``` FUNCTION main VAR s AT str; // omitted data-type END_VAR END_FUNCTION ```
1 parent 446f073 commit 1406d38

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/parser.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,12 @@ fn parse_variable_line(lexer: &mut ParseSession) -> Vec<Variable> {
11321132
address = parse_hardware_access(lexer, direction, access_type)
11331133
}
11341134

1135-
Identifier => return vec![parse_aliasing(lexer, &var_names[0]).unwrap()],
1135+
Identifier => {
1136+
return match parse_aliasing(lexer, &var_names[0]) {
1137+
Some(aliased_variable) => vec![aliased_variable],
1138+
None => vec![],
1139+
};
1140+
}
11361141

11371142
_ => {
11381143
lexer.accept_diagnostic(Diagnostic::missing_token(

0 commit comments

Comments
 (0)