Exemplo n.º 1
0
        protected override bool TryParse(string[] parts, out Statement statement)
        {
            statement = null;

            var setVar = new SetVarStatement();

            if (parts.Count(p => p.Length > 0) < 3)
                return false;

            if(!string.Equals(parts[0], ":setvar", StringComparison.InvariantCultureIgnoreCase))
                return false;

            setVar.VariableName = parts.Skip(1).First(p => p.Length > 0);

            var value = string.Join(" ", parts.Skip(2));

            if(value.StartsWith("\"") ^ value.EndsWith("\""))
                return false;

            value = value.Trim('\"');

            setVar.VariableValue = value;

            statement = setVar;

            return true;
        }
Exemplo n.º 2
0
        protected override bool TryGetStatement(Match match, out Statement statement)
        {
            statement = null;

            var setVar = new SetVarStatement
            {
                VariableName = match.Groups["name"].Value
            };

            if(!match.Groups["value"].Success)
                return false;

            var value = match.Groups["value"].Value.Trim();

            if (value.StartsWith("\"") ^ value.EndsWith("\""))
                return false;

            value = value.Trim('\"');

            setVar.VariableValue = value;

            statement = setVar;

            return true;
        }
Exemplo n.º 3
0
 public void AcceptSetVar(SetVarStatement statement)
 {
     _methodSequence.Add(VisitorMethod.AcceptSetVar);
 }
Exemplo n.º 4
0
 public void AcceptSetVar(SetVarStatement statement)
 {
     _builder.AppendLine("--SETVAR processed");
     _builder.AppendLine(string.Format("--{0}", statement.InitialString));
 }