grammars-v4
grammars-v4 copied to clipboard
Switch statment missing in Python grammar
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.