public StringLiteral(string value, StatementTail tail) : base("string", tail) { if (IsWrappedInQuotes(value)) { ValueType = ValueType.StringLiteral; //strip quotes const int quoteOffset = 1; value = new string(value.ToArray(), quoteOffset, value.Length - (quoteOffset + 1)); } else if (value == "this") { ValueType = ValueType.Local; } else if (value == "null" || value == "true" || value == "false") { ValueType = ValueType.Keyword; } else { ValueType = ValueType.Property; } if (ValueType == ValueType.StringLiteral) { Values = Parse(value); } }
public Statement(IHost host, string name, StatementTail statementTail) : this(host, name) { if (statementTail != null) { if (statementTail.Parameters != null) { Parameters = statementTail.Parameters; } //AddAttributes(statementTail.Attributes); if (statementTail.Attributes != null) { for (int i = 0; i < Attributes.Count; i++) { statementTail.Attributes.Add(Attributes[i]); } Attributes = statementTail.Attributes; } if (statementTail.Children != null) { Children = statementTail.Children; } } }
private Statement GetStatementFromToken(Token identifier, StatementTail tail, Token previousToken = null) { var value = identifier != null ? identifier.Content : ""; if (identifier != null) { switch (identifier.Type) { case TokenType.StringLiteral: case TokenType.QuotedStringLiteral: return new StringLiteral(value, tail) { Index = identifier.Index }; case TokenType.StringLiteralPipe: return new StringLiteralPipe(value.Substring(1), tail) { Index = identifier.Index }; } } if (previousToken != null) { switch (previousToken.Type) { case TokenType.At: return new EncodedOutput(value) { Index = previousToken.Index }; case TokenType.Equal: return new RawOutput(value) { Index = previousToken.Index }; } } return new Statement(value, tail) { Index = identifier.Index }; }
protected internal void ParseStatementTail(StatementTail statementTail) { if (statementTail != null) { if (statementTail.Parameters != null) { Parameters = statementTail.Parameters; } //AddAttributes(statementTail.Attributes); if (statementTail.Attributes != null) { foreach (Attribute attribute in Attributes) { statementTail.Attributes.Add(attribute); } Attributes = statementTail.Attributes; } if (statementTail.Children != null) { Children = statementTail.Children; } } }
private StatementTail ParseSingleStatementTail(Stream stream, StatementTail tail) { var statementList = ParseStatement(stream); //Parrot.Debugger.Debug.WriteLine("Found Single statement tail"); if (tail == null) { tail = new StatementTail(); } tail.Children = statementList; return tail; }
public EncodedOutput(string variableName, StatementTail tail) : base("\"@" + variableName + "\"", tail) { }
public RawOutput(string variableName, StatementTail tail) : base("\"=" + variableName + "\"", tail) { }
public Statement(string name, StatementTail statementTail) : this(name) { ParseStatementTail(statementTail); }