Skip to content

Commit

Permalink
Remove unnecessary parser rules
Browse files Browse the repository at this point in the history
  • Loading branch information
vipentti committed Dec 22, 2023
1 parent 9bb9e88 commit 3481f7a
Show file tree
Hide file tree
Showing 3 changed files with 909 additions and 1,125 deletions.
43 changes: 2 additions & 41 deletions src/Visp.Compiler/Parser.fsy
Original file line number Diff line number Diff line change
Expand Up @@ -958,9 +958,6 @@ record_init_init:
SynInit(s, e, lhs parseState)
}
| record_init_parens { $1 }
// | expr %prec prec_record_expr_only
// { SynInit(Syntax.mkSynSymbol "_" (lhs parseState), $1, lhs parseState)
// }

record_init_list: rev_record_init_list { List.rev $1 }
rev_record_init_list:
Expand Down Expand Up @@ -996,9 +993,9 @@ rev_attributes:
| rev_attributes DOT attribute { $3 :: $1 }

attribute:
| syntype_ident expr
| syn_type_name expr
{ { TypeName = $1; ArgExpr = $2; Range = lhs parseState } }
| syntype_ident
| syn_type_name
{ { TypeName = $1; ArgExpr = Syntax.UnitExpr <| lhs parseState; Range = lhs parseState } }

member_list_start:
Expand Down Expand Up @@ -1049,9 +1046,6 @@ member_in_parens:
| INTERFACE symbol_with_ops member_list
{ SynTypeMember.Interface($2, $3, lhs parseState)}

tok_lparen:
| LPAREN { () }

empty_bindings:
| LPAREN RPAREN { [] }
| LBRACKET RBRACKET { [] }
Expand Down Expand Up @@ -1093,39 +1087,6 @@ keyword:
SynKeyword(Ident(text, lhs parseState))
}

syn_comma:
| COMMA %prec prec_syn_comma { () }

raw_syntype_ident_text:
| SYMBOL %prec prec_syn_type { $1 }

syntype_ident:
| raw_syntype_ident_text %prec prec_syn_type { SynType.Ident(Ident($1, lhs parseState))}
| QUOTE_SYM raw_syntype_ident_text
{ let text = $2
SynType.Ident(Ident("'" + text, lhs parseState))
}
//| raw_syntype_ident_text COMMA syntype_comma_list
// {
// let text = $1
// let rest = $3
// SynType.Ident(Ident(text + "," + (String.concat "," rest), lhs parseState))
// }
| syntype_ident OP_LESS syntype_ident OP_GREATER
{ SynType.Generic($1, [$3], lhs parseState) }
| syntype_ident OP_LESS syntype_ident COMMA syntype_ident_list OP_GREATER
{ SynType.Generic($1, $3 :: $5, lhs parseState) }

syntype_comma_list: rev_syntype_comma_list { List.rev $1 }
rev_syntype_comma_list:
| raw_syntype_ident_text %prec prec_syn_type { [$1] }
| rev_syntype_comma_list COMMA SYMBOL %prec prec_syn_comma { $3 :: $1 }

syntype_ident_list: rev_syntype_ident_list { List.rev $1 }
rev_syntype_ident_list:
| syntype_ident %prec prec_syn_type { [$1] }
| rev_syntype_ident_list COMMA syntype_ident %prec prec_syn_comma { $3 :: $1 }

syn_type:
// | syn_type_paren %prec prec_syn_type_paren { $1 }
| LPAREN syn_type RPAREN %prec prec_syn_type_paren
Expand Down
Loading

0 comments on commit 3481f7a

Please sign in to comment.