/// <summary> /// fun_arg = identifier ":" [ "ref" ] type /// </summary> private FunctionArgument parseFunSingleArg(bool required = false) { if (!peek(LexemType.Identifier)) return null; var node = new FunctionArgument(); node.Name = getValue(); if (!check(LexemType.Colon)) { if (required) error(ParserMessages.SymbolExpected, ":"); else return null; } node.IsRefArgument = check(LexemType.Ref); node.TypeSignature = ensure(parseType, ParserMessages.ArgTypeExpected); return node; }
/// <summary> /// fun_arg = identifier [ ":" [ "ref" ] type [ "... " ] ] /// </summary> private FunctionArgument parseFunSingleArg(bool required = false) { if (!peek(LexemType.Identifier)) return null; var node = new FunctionArgument(); node.Name = getValue(); if (!check(LexemType.Colon)) { if (required) error(ParserMessages.SymbolExpected, ":"); node.Type = typeof (UnspecifiedType); return node; } node.IsRefArgument = check(LexemType.Ref); node.TypeSignature = ensure(parseType, ParserMessages.ArgTypeExpected); if (check(LexemType.Ellipsis)) { if(node.IsRefArgument) error(ParserMessages.VariadicByRef); node.IsVariadic = true; } return node; }
protected bool Equals(FunctionArgument other) { return(string.Equals(Name, other.Name) && string.Equals(TypeSignature, other.TypeSignature)); }
protected bool Equals(FunctionArgument other) { return string.Equals(Name, other.Name) && string.Equals(TypeSignature, other.TypeSignature); }