public AssignStatement(SymbolReference target, Expression value, SourcePosition start, SourcePosition end) : base(ASTNodeType.AssignStatement, start, end) { Target = target; Value = value; }
public ConditionalExpression(Expression cond, Expression first, Expression second, SourcePosition start, SourcePosition end) : base(ASTNodeType.ConditionalExpression, start, end) { Condition = cond; TrueExpression = first; FalseExpression = second; }
public Enumeration(String name, List<VariableIdentifier> values, SourcePosition start, SourcePosition end) : base(name, start, end) { Type = ASTNodeType.Enumeration; Values = values; }
public InOpReference(InOpDeclaration op, Expression lhs, Expression rhs, SourcePosition start, SourcePosition end) : base(ASTNodeType.InOpRef, start, end) { Operator = op; LeftOperand = lhs; RightOperand = rhs; }
public WhileLoop(Expression cond, CodeBody body, SourcePosition start, SourcePosition end) : base(ASTNodeType.WhileLoop, start, end) { Condition = cond; Body = body; }
public ArraySymbolRef(Expression array, Expression index, SourcePosition start, SourcePosition end) : base(array, start, end) { Index = index; Type = ASTNodeType.ArrayReference; Array = array; }
public CompositeSymbolRef(Expression outer, Expression inner, SourcePosition start, SourcePosition end) : base(inner, start, end) { InnerSymbol = inner; OuterSymbol = outer; Type = ASTNodeType.CompositeReference; }
public void LogError(String msg, SourcePosition start = null, SourcePosition end = null) { if (start == null && end == null) content.Add(new Error(msg)); else content.Add(new LineError(msg, start, end)); }
public bool Equals(SourcePosition p) { if ((object)p == null) return false; return (Line == p.Line) && (Column == p.Column) && (CharIndex == p.CharIndex); }
public SwitchStatement(Expression expr, CodeBody body, SourcePosition start, SourcePosition end) : base(ASTNodeType.SwitchStatement, start, end) { Expression = expr; Body = body; }
public void TestKeywordMatcher() { KeywordMatcher matcher = new KeywordMatcher("invalid", TokenType.INVALID, Delimiters, false); StringTokenizer data = new StringTokenizer("+=+//= invalid=invalidinvalid$="); SourcePosition streamPos = new SourcePosition(0, 0, 0); // Match a basic delimiter keyword Assert.AreEqual(Delimiters.Find(m => m.Keyword == "+=").MatchNext(data, ref streamPos, Log).Type, TokenType.AddAssign); Assert.AreEqual(data.CurrentItem, "+"); data.Advance(); // Assert that the matched token contains the value Assert.AreEqual(Delimiters.Find(m => m.Keyword == "/").MatchNext(data, ref streamPos, Log).Value, "/"); Assert.AreEqual(data.CurrentItem, "/"); data.Advance(3); // Match against a keyword rather than short operator as well as delimiter Assert.IsNotNull(matcher.MatchNext(data, ref streamPos, Log)); Assert.AreEqual(data.CurrentItem, "="); data.Advance(); // Assert that non-delimiters will prevent a match Assert.IsNull(matcher.MatchNext(data, ref streamPos, Log)); Assert.AreEqual(data.CurrentItem, "i"); data.Advance(14); // Ensure EOF with keywords Assert.IsNotNull(Delimiters.Find(m => m.Keyword == "$=").MatchNext(data, ref streamPos, Log)); Assert.IsTrue(data.AtEnd()); }
public IfStatement(Expression cond, CodeBody then, SourcePosition start, SourcePosition end, CodeBody optelse = null) : base(ASTNodeType.IfStatement, start, end) { Condition = cond; Then = then; Else = optelse; }
public VariableDeclaration(VariableType type, List<Specifier> specs, List<VariableIdentifier> names, SourcePosition start, SourcePosition end) : base(ASTNodeType.VariableDeclaration, start, end) { Specifiers = specs; VarType = type; Variables = names; }
public PreOpDeclaration(String keyword, bool delim, CodeBody body, VariableType returnType, FunctionParameter operand, List<Specifier> specs, SourcePosition start, SourcePosition end) : base(ASTNodeType.PrefixOperator, keyword, delim, body, returnType, specs, start, end) { Operand = operand; }
public Struct(String name, List<Specifier> specs, List<VariableDeclaration> members, SourcePosition start, SourcePosition end, VariableType parent = null) : base(name, start, end) { Type = ASTNodeType.Struct; Specifiers = specs; Members = members; Parent = parent; }
public InOpDeclaration(String keyword, int precedence, bool delim, CodeBody body, VariableType returnType, FunctionParameter leftOp, FunctionParameter rightOp, List<Specifier> specs, SourcePosition start, SourcePosition end) : base(ASTNodeType.InfixOperator, keyword, delim, body, returnType, specs, start, end) { LeftOperand = leftOp; RightOperand = rightOp; Precedence = precedence; }
public ForLoop(Expression cond, CodeBody body, Statement init, Statement update, SourcePosition start, SourcePosition end) : base(ASTNodeType.WhileLoop, start, end) { Condition = cond; Body = body; Init = init; Update = update; }
public OperatorDeclaration(ASTNodeType type, String keyword, bool delim, CodeBody body, VariableType returnType, List<Specifier> specs, SourcePosition start, SourcePosition end) : base(type, start, end) { OperatorKeyword = keyword; isDelimiter = delim; Body = body; ReturnType = returnType; Specifiers = specs; Locals = new List<VariableDeclaration>(); }
public Function(String name, VariableType returntype, CodeBody body, List<Specifier> specs, List<FunctionParameter> parameters, SourcePosition start, SourcePosition end) : base(ASTNodeType.Function, start, end) { Name = name; Body = body; ReturnType = returntype; Specifiers = specs; Parameters = parameters; Locals = new List<VariableDeclaration>(); }
public State(String name, CodeBody body, List<Specifier> specs, State parent, List<Function> funcs, List<Function> ignores, List<StateLabel> labels, SourcePosition start, SourcePosition end) : base(ASTNodeType.State, start, end) { Name = name; Body = body; Specifiers = specs; Parent = parent; Functions = funcs; Ignores = ignores; Labels = labels; Locals = new List<VariableDeclaration>(); }
public Class(String name, List<Specifier> specs, List<VariableDeclaration> vars, List<VariableType> types, List<Function> funcs, List<State> states, VariableType parent, VariableType outer, List<OperatorDeclaration> ops, SourcePosition start, SourcePosition end) : base(name, start, end) { Parent = parent; OuterClass = outer; Specifiers = specs; VariableDeclarations = vars; TypeDeclarations = types; Functions = funcs; States = states; Operators = ops; Type = ASTNodeType.Class; }
public Specifier(String value, SourcePosition start, SourcePosition end) : base(ASTNodeType.Specifier, start, end) { Value = value; }
public StateLabel(String name, int offset, SourcePosition start, SourcePosition end) : base(ASTNodeType.StateLabel, start, end) { StartOffset = offset; Name = name; }
public IntegerLiteral(int val, SourcePosition start, SourcePosition end) : base(ASTNodeType.IntegerLiteral, start, end) { Value = val; }
public LineError(String msg, SourcePosition start, SourcePosition end) : base(msg, start, end) { }
public LineWarning(String msg, SourcePosition start, SourcePosition end) : base(msg, start, end) { }
public StopStatement(SourcePosition start, SourcePosition end) : base(ASTNodeType.StopStatement, start, end) { }
public FunctionCall(SymbolReference func, List<Expression> parameters, SourcePosition start, SourcePosition end) : base(ASTNodeType.FunctionCall, start, end) { Function = func; Parameters = parameters; }
public void LogMessage(String msg, SourcePosition start = null, SourcePosition end = null) { if (start == null && end == null) content.Add(new LogMessage(msg)); else content.Add(new PositionedMessage(msg, start, end)); }
public FloatLiteral(float val, SourcePosition start, SourcePosition end) : base(ASTNodeType.FloatLiteral, start, end) { Value = val; }