public override void LoadCommand(Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { m_lineNumber = serializer.LineNumber; double position = 0; bool found = false; ProjectV2.Token posToken = serializer.ReadNumericToken(this, ref position, out found); if (posToken != null) { _Position = (int)position; if (serializer.ReadTextToken(this) != null) { serializer.Warn("The capitalize command requires zero or one argument.", this); } } else if (found) { serializer.Warn("The capitalize command requires the first argument to be an integer.", this); } else { _Position = -1; } }
public override void LoadCommand(Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { m_lineNumber = serializer.LineNumber; bool found = false; double amount = 0.0; ProjectV2.Token amountToken = serializer.ReadNumericToken(this, ref amount, out found); if (amountToken != null) { _Amount = (int)amount; if (serializer.ReadTextToken(this) != null) { serializer.Warn("The leave command requires zero or one argument.", this); } } else if (found) { serializer.Warn("The leave command requires the first argument to be a positive integer.", this); } else { _Amount = 1; } }
public override void LoadCommand(Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { m_lineNumber = serializer.LineNumber; ProjectV2.Token name = serializer.ReadTextToken(this); if (name != null) { Name = name.Text; name.Type = Whee.WordBuilder.ProjectV2.TokenType.Name; ProjectV2.Token value = serializer.ReadTextToken(this); if (value != null) { Value = value.Text; if (serializer.ReadTextToken(this) != null) { serializer.Warn("The mark command requires 2 arguments.", this); } } else { serializer.Warn("The mark command requires 2 arguments.", this); } } else { serializer.Warn("The mark command requires 2 arguments.", this); } }
public override void CheckSanity(Project project, Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { if (_StartIndex > 0 && _EndIndex > 0 && _EndIndex < _StartIndex) { serializer.Warn("You want to start after the end?", this); } if (_StartIndex < 0 && _EndIndex < 0 && _EndIndex < _StartIndex) { serializer.Warn("You want to start after the end?", this); } }
public override void CheckSanity(Project project, Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { int count = project.TokenSets.CountByName(TokenSet); if (count == 0) { serializer.Warn(string.Format("The token set '{0}' does not exist.", TokenSet), this); } else if (count > 1) { serializer.Warn(string.Format("Multiple token sets with the name '{0}' exist.", TokenSet), this); } }
public override void CheckSanity(Project project, Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { if (_Position == 0) { serializer.Warn("The capitalize command requires the first argument to be a non-zero integer.", this); } }
public override void CheckSanity(Project project, Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { if (_Amount < 0) { serializer.Warn("Leave command requires a positive integer or zero as its second argument.", this); } }
public override void CheckSanity(Project project, Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { m_project = project; if (project.Rules.GetRuleByName(Rule) == null) { serializer.Warn(string.Format("The rule '{0}' does not exist.", Rule), this); } }
public override void LoadCommand(Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { m_lineNumber = serializer.LineNumber; ProjectV2.Token literal = serializer.ReadTextToken(this); if (literal != null) { Literal = literal.Text; if (serializer.ReadTextToken(this) != null) { serializer.Warn("The prelit command requires 1 argument.", this); } } else { serializer.Warn("The prelit command requires 1 argument.", this); } }
public override void LoadCommand(Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { m_lineNumber = serializer.LineNumber; ProjectV2.Token tokenSet = serializer.ReadTextToken(this); if (tokenSet != null) { _TokenSet = tokenSet.Text; if (serializer.ReadTextToken(this) != null) { serializer.Warn("The prefix command requires one argument.", this); } } else { serializer.Warn("The prefix command requires one argument.", this); } }
public override void CheckSanity(Project project, Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { m_project = project; if (_stringmapping.Count == 0) { serializer.Warn("The Translate command requires at least one translation directive.", this); } foreach (string[] key in _stringmapping.Keys) { Regex reg = MakeRegex(key); _mapping.Add(reg, _stringmapping[key]); } }
public override void LoadCommand(Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { m_lineNumber = serializer.LineNumber; ProjectV2.CommandBlockNode cbn = new ProjectV2.CommandBlockNode(serializer); if (cbn.Commands.Count > 0) { Children.Add(cbn); foreach (CommandBase cmd in cbn.Commands) { Commands.Add(cmd); } } else { serializer.Warn("The apply command expects a command block.", this); } }
public override void LoadCommand(Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { m_lineNumber = serializer.LineNumber; bool found = false; double amount = 0.0; ProjectV2.Token amountToken = serializer.ReadNumericToken(this, ref amount, out found); if (amountToken != null) { _StartIndex = (int)amount; amountToken = serializer.ReadNumericToken(this, ref amount, out found); if (amountToken != null) { _EndIndex = (int)amount; if (serializer.ReadTextToken(this) != null) { serializer.Warn("The substring command requires one or two arguments.", this); } } else if (found) { serializer.Warn("The substring command requires its arguments to be positive integers.", this); } } else if (found) { serializer.Warn("The substring command requires its arguments to be positive integers.", this); } else { serializer.Warn("The substring command requires one or two arguments.", this); } }
public override void LoadCommand(Whee.WordBuilder.ProjectV2.IProjectSerializer serializer) { double num = 0; bool found = true; Token amount = null; while (found) { amount = serializer.ReadNumericToken(this, ref num, out found); if (amount != null) { _Repetitions.Add((int)num); } if (amount == null && found) { int reps = 0; string data; amount = serializer.ReadRepeatingToken(this, out reps, out data); if (amount != null) { List<int> numbers = new List<int>(); foreach (string numstring in data.Split(' ')) { int number = 0; if (int.TryParse(numstring, out number)) { numbers.Add(number); } else { serializer.Warn("Expected numbers only", this); } } for (int i = 0; i < reps; i++) { _Repetitions.AddRange(numbers); } } else { found = false; } } } CommandBlockNode cbn = new CommandBlockNode(serializer); Children.Add(cbn); foreach (CommandBase cmd in cbn.Commands) { Commands.Add(cmd); } }