public Syntax_Tokens_Set(Syntax_Kind_of_Token kind_Of_Token, int position, string text, object value) { Kind_Of_Token = kind_Of_Token; Position = position; Text = text; Value = value; }
public static int Get_Binary_Operator_Precedence(this Syntax_Kind_of_Token kind_of_token_object) { switch (kind_of_token_object) { case Syntax_Kind_of_Token.Star_Token: case Syntax_Kind_of_Token.Slash_Token: return(5); case Syntax_Kind_of_Token.Plus_Token: case Syntax_Kind_of_Token.Minus_Token: return(4); case Syntax_Kind_of_Token.Equals_Equals_Token: case Syntax_Kind_of_Token.Not_Equals_Token: return(3); case Syntax_Kind_of_Token.Ampersand_Ampersand_Token: return(2); case Syntax_Kind_of_Token.Pipe_Pipe_Token: return(1); default: return(0); } }
private Bound_Unary_Operator(Syntax_Kind_of_Token syntax_kind, Bound_Unary_Operator_Kind kind, Type operand_type, Type result_type) { Syntax_Kind = syntax_kind; Kind = kind; Operand_Type = operand_type; Type = result_type; }
private Bound_Binary_Operator(Syntax_Kind_of_Token syntax_kind, Bound_Binary_Operator_Kind kind, Type left_type, Type right_type, Type result_type) { Syntax_Kind = syntax_kind; Kind = kind; Left_Type = left_type; Right_Type = right_type; Type = result_type; }
public static Bound_Unary_Operator Bind(Syntax_Kind_of_Token syntax_kind, Type operand_type) { foreach (var op in _operators) { if (op.Syntax_Kind == syntax_kind && op.Operand_Type == operand_type) { return(op); } } return(null); }
private Syntax_Tokens_Set Match_Token(Syntax_Kind_of_Token kind_of_token_object) { if (Current_Node.Kind_Of_Token == kind_of_token_object) { return(Next_Token_in_Set()); } _diagnostics.Add($"ERROR: Unexpected Token <{Current_Node.Kind_Of_Token}>, expected <{kind_of_token_object}>"); return(new Syntax_Tokens_Set(kind_of_token_object, Current_Node.Position, null, null)); }
public static Bound_Binary_Operator Bind(Syntax_Kind_of_Token syntax_kind, Type left_type, Type right_type) { foreach (var op in _operators) { if (op.Syntax_Kind == syntax_kind && op.Left_Type == left_type && op.Right_Type == right_type) { return(op); } } return(null); }
private Syntax_Tokens_Set Match_Token(Syntax_Kind_of_Token kind_of_token_object) { if (Current_Node.Kind_Of_Token == kind_of_token_object) { return(Next_Token_in_Set()); } _diagnostics.Report_Unexpected_Token(Current_Node.Span, Current_Node.Kind_Of_Token, kind_of_token_object); return(new Syntax_Tokens_Set(kind_of_token_object, Current_Node.Position, null, null)); }
public static int Get_Unary_Operator_Precedence(this Syntax_Kind_of_Token kind_of_token_object) { switch (kind_of_token_object) { case Syntax_Kind_of_Token.Plus_Token: case Syntax_Kind_of_Token.Minus_Token: case Syntax_Kind_of_Token.Not_Token: return(6); default: return(0); } }
private Bound_Unary_Operator(Syntax_Kind_of_Token syntax_kind, Bound_Unary_Operator_Kind kind, Type operand_type) : this(syntax_kind, kind, operand_type, operand_type) { }
private Bound_Binary_Operator(Syntax_Kind_of_Token syntax_kind, Bound_Binary_Operator_Kind kind, Type type) : this(syntax_kind, kind, type, type, type) { }
public void Report_Unexpected_Token(Text_Span span, Syntax_Kind_of_Token actual_kind, Syntax_Kind_of_Token expected_kind) { var message = $"Unexpected token <{actual_kind}>, expected <{expected_kind}>......"; }