grammars-v4 icon indicating copy to clipboard operation
grammars-v4 copied to clipboard

Switch statment missing in Python grammar

Open Kawser-nerd opened this issue 3 years ago • 0 comments
trafficstars

Rule for switch statements is missing in the present Python lexer and parser. I have added them. The rules I added are given below: PythonLexer.g4: SWITCH : 'switch'; CASE : 'case'; DEFAULT : 'default';

PythonParser.g4: small_stmt: switch_stmt #switch

switch_stmt : SWITCH OPEN_PAREN name CLOSE_PAREN | case_stmt ;

case_stmt : CASE number COLON | DEFAULT COLON ;

Please check and update the rules if they are perfect. In my side they are working.

Kawser-nerd avatar Dec 20 '21 05:12 Kawser-nerd