File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131 < select id ="action " class ="plrb-tools-more-tools-button ">
3232 < option value ="eval "> Evaluate</ option >
3333 < option value ="compile "> Compile</ option >
34- < option value ="syntax "> Syntax</ option >
34+ < option value ="syntax "> Syntax (parse.y) </ option >
3535 < option value ="syntax+prism "> Syntax (Prism)</ option >
3636 </ select >
3737 < button id ="button-run " class ="plrb-tools-do-button ">
Original file line number Diff line number Diff line change @@ -236,19 +236,23 @@ export class RubyWorker {
236236 switch ( action ) {
237237 case "eval" : break
238238 case "compile" : extraArgs . push ( "--dump=insns" ) ; break
239- case "syntax" : extraArgs . push ( "--dump=parsetree" ) ; break
240- case "syntax+prism" :
239+ case "syntax" : {
241240 const rubyVersion = this . _rubyVersion ( ) ;
242- if ( rubyVersion . startsWith ( "3.3 ." ) ) {
243- // --dump=prism_parsetree exists only in 3.3.x
244- extraArgs . push ( "--dump=prism_parsetree " ) ;
241+ if ( rubyVersion . startsWith ( "3.2 ." ) ) {
242+ // 3.2.x and earlier do not have explicit --parser=parse.y
243+ extraArgs . push ( "--dump=parsetree " ) ;
245244 } else {
246- // After 3.3.x, --parser=prism is introduced
247- // https://bugs.ruby-lang.org/issues/20270
248- extraArgs . push ( "--parser=prism" ) ;
245+ // 3.3.x and later have --parser=parse.y
246+ extraArgs . push ( "--parser=parse.y" ) ;
249247 extraArgs . push ( "--dump=parsetree" ) ;
250248 }
251249 break
250+ }
251+ case "syntax+prism" : {
252+ extraArgs . push ( "--parser=prism" ) ;
253+ extraArgs . push ( "--dump=parsetree" ) ;
254+ break
255+ }
252256 default : throw new Error ( `Unknown action: ${ action } ` )
253257 }
254258
You can’t perform that action at this time.
0 commit comments