File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1459,7 +1459,20 @@ where
14591459 for i in 0 ..grm. prod ( pidx) . len ( ) {
14601460 let argt = match grm. prod ( pidx) [ i] {
14611461 Symbol :: Rule ( ref_ridx) => {
1462- str:: parse :: < TokenStream > ( grm. actiontype ( ref_ridx) . as_ref ( ) . unwrap ( ) ) ?
1462+ if let Some ( action_type) = grm. actiontype ( ref_ridx) . as_ref ( ) {
1463+ str:: parse :: < TokenStream > ( action_type) ?
1464+ } else {
1465+ let mut s = String :: from ( "\n " ) ;
1466+ let rule_span = grm. rule_name_span ( ref_ridx) ;
1467+ s. push_str ( & diag. file_location_msg ( "Error" , Some ( rule_span) ) ) ;
1468+ s. push_str ( "\n " ) ;
1469+ s. push_str ( & diag. underline_span_with_text (
1470+ rule_span,
1471+ "Rule missing action type" . to_string ( ) ,
1472+ '^' ,
1473+ ) ) ;
1474+ return Err ( ErrorString ( s) . into ( ) ) ;
1475+ }
14631476 }
14641477 Symbol :: Token ( _) => {
14651478 let lexemet =
@@ -1530,6 +1543,8 @@ where
15301543 let inner_span =
15311544 Span :: new ( span. start ( ) + last + off + "$" . len ( ) , span. end ( ) ) ;
15321545 let mut s = String :: from ( "\n " ) ;
1546+ s. push_str ( & diag. file_location_msg ( "Error" , Some ( inner_span) ) ) ;
1547+ s. push_str ( "\n " ) ;
15331548 s. push_str ( & diag. underline_span_with_text (
15341549 inner_span,
15351550 "Unknown text following '$'" . to_string ( ) ,
You can’t perform that action at this time.
0 commit comments