diff --git a/ssc/ast/nodes.functions.cs b/ssc/ast/nodes.functions.cs index 2bb88ad..146ec79 100644 --- a/ssc/ast/nodes.functions.cs +++ b/ssc/ast/nodes.functions.cs @@ -61,12 +61,7 @@ namespace arookas { public sunParameterInfo ParameterInfo { get { return new sunParameterInfo(Parameters, IsVariadic); } } public sunParameterList(sunSourceLocation location) - : base(location) { - var count = this.Count(i => i is sunEllipsis); - if (count > 1 || (count > 0 && !(this[Count - 1] is sunEllipsis))) { - throw new sunVariadicParameterListException(this); - } - } + : base(location) { } } class sunEllipsis : sunNode { diff --git a/ssc/parser.cs b/ssc/parser.cs index 5595cbb..e7579c3 100644 --- a/ssc/parser.cs +++ b/ssc/parser.cs @@ -52,9 +52,7 @@ namespace arookas { case __sunConstants.BINARY_OPERATOR: case __sunConstants.UNARY_OPERATOR: case __sunConstants.AUGMENT_OPERATOR: - case __sunConstants.TERM: - case __sunConstants.PARAMETER: - case __sunConstants.ARGUMENT: { + case __sunConstants.TERM: { return ast[0]; } } @@ -176,9 +174,7 @@ namespace arookas { case __sunConstants.FUNCTION_CALL: return new sunFunctionCall(location); case __sunConstants.PARAMETER_LIST: return new sunParameterList(location); - case __sunConstants.PARAMETER: return new sunNode(location); case __sunConstants.ARGUMENT_LIST: return new sunNode(location); - case __sunConstants.ARGUMENT: return new sunNode(location); } // variables diff --git a/ssc/sunscript.grammar b/ssc/sunscript.grammar index b63ddb3..e23a97c 100644 --- a/ssc/sunscript.grammar +++ b/ssc/sunscript.grammar @@ -193,10 +193,8 @@ prefix_augment = augment_operator IDENTIFIER; function_definition = FUNCTION IDENTIFIER parameter_list statement_block; function_call = IDENTIFIER argument_list; -parameter_list = L_PAREN [parameter {COMMA parameter}] R_PAREN; // e.g. (a, b, ...) -parameter = IDENTIFIER | ELLIPSIS; -argument_list = L_PAREN [argument {COMMA argument}] R_PAREN; -argument = expression; +parameter_list = L_PAREN [IDENTIFIER {COMMA IDENTIFIER} [COMMA ELLIPSIS] | ELLIPSIS] R_PAREN; // e.g. (a, b, ...) +argument_list = L_PAREN [expression {COMMA expression}] R_PAREN; // builtins builtin_declaration = BUILTIN IDENTIFIER parameter_list;