File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -858,21 +858,23 @@ impl<'i> Parser<'i> {
858858
859859 ( name, parameters)
860860 } else {
861- // Check if the text contains multiple space-separated identifiers
862- // which would indicate parameters without parentheses
861+ // Check if there are multiple words (procedure name + anything
862+ // else) which would indicates parameters without parentheses
863863 let words: Vec < & str > = text
864864 . trim ( )
865865 . split_whitespace ( )
866866 . collect ( ) ;
867867 if words. len ( ) > 1 {
868- // Check if all words look like valid identifiers
869- let all_valid_identifiers = words
870- . iter ( )
871- . all ( |word| validate_identifier ( word) . is_some ( ) ) ;
872-
873- if all_valid_identifiers {
874- return Err ( ParsingError :: InvalidParameters ( self . offset ) ) ;
875- }
868+ // Calculate position of first mistaken parameter-ish thing
869+ let first_space_pos = text
870+ . find ( ' ' )
871+ . unwrap_or ( 0 ) ;
872+ let first_param_pos = text[ first_space_pos..]
873+ . trim_start ( )
874+ . as_ptr ( ) as isize
875+ - text. as_ptr ( ) as isize ;
876+ let error_offset = self . offset + one. start ( ) + first_param_pos as usize ;
877+ return Err ( ParsingError :: InvalidParameters ( error_offset) ) ;
876878 }
877879
878880 let name = validate_identifier ( text) . ok_or ( ParsingError :: InvalidIdentifier (
Original file line number Diff line number Diff line change 33make_coffee beans : Beans -> Espresso
44
55make_coffee beans water : Beans, Water -> Cappuccino
6+
7+ make_coffee Beans, Water :
You can’t perform that action at this time.
0 commit comments