public HamlNodeHtmlAttribute(HamlSourceFileMetrics metrics, string nameValuePair) : base(metrics, nameValuePair) { int index = 0; ParseName(ref index); ParseValue(index); }
public HamlNodeHtmlAttributeCollection(HamlSourceFileMetrics metrics, string attributeCollection) : base(metrics, attributeCollection) { if (Content[0] != '(' && Content[0] != '{') throw new HamlParserMalformedTagException("AttributeCollection tag must start with an opening bracket or curly bracket.", Metrics); ParseChildren(attributeCollection); }
public HamlNodeTextContainer(HamlSourceFileMetrics metrics, string content) : base(metrics, content) { if (string.IsNullOrEmpty(content)) AddChild(new HamlNodeTextLiteral(Metrics.SubSpan(0, 0), content)); else ParseFragments(content); }
public HamlLine(string content, HamlRuleEnum hamlRule, HamlSourceFileMetrics metrics = null, string indent = "", bool isInline = false) { Metrics = metrics ?? new HamlSourceFileMetrics(0, -1, content.Length, 0); Content = content; Indent = isInline ? "" : indent; IndentCount = IsBlankLine(content, hamlRule) ? 0 : GetIndentCount(indent); HamlRule = hamlRule; IsInline = isInline; }
public static IEnumerable<HamlLine> ParseHamlLine(string currentLine, int currentLineIndex) { int whiteSpaceIndex = 0; while (whiteSpaceIndex < currentLine.Length && (currentLine[whiteSpaceIndex] == ' ' || currentLine[whiteSpaceIndex] == '\t')) { whiteSpaceIndex++; } string indent = currentLine.Substring(0, whiteSpaceIndex); string content = (whiteSpaceIndex == currentLine.Length) ? "" : currentLine.Substring(whiteSpaceIndex); int tokenLength = 0; var hamlRule = HamlRuleFactory.ParseHamlRule(ref content, out tokenLength); var metrics = new HamlSourceFileMetrics(currentLineIndex, whiteSpaceIndex, currentLine.Length - whiteSpaceIndex, tokenLength); var result = new List<HamlLine>(); var line = new HamlLine(content, hamlRule, metrics, indent, false); ProcessInlineTags(line, result); return result; }
private HamlInvalidChildNodeException(Type nodeType, Type childType, HamlSourceFileMetrics lineNo, Exception ex) : base(string.Format("Node '{0}' has invalid child node {1} at {2}", nodeType.FullName, childType.FullName, lineNo), ex) { }
public HamlNodeTagClass(HamlSourceFileMetrics metrics, string className) : base(metrics, className) { }
private static void ProcessInlineTags(HamlLine line, List<HamlLine> result) { if (IsRuleThatAllowsInlineContent(line.HamlRule)) { int contentIndex = GetEndOfTagIndex('%' + line.Content)-1; if (contentIndex < line.Content.Length-1) { string subTag = line.Content.Substring(contentIndex); line.Content = line.Content.Substring(0, contentIndex); int tokenLength; var subTagRule = HamlRuleFactory.ParseHamlRule(ref subTag, out tokenLength); var colNo = contentIndex + line.Metrics.TokenLength; var metrics = new HamlSourceFileMetrics(line.Metrics.LineNo, line.Metrics.ColNo + colNo, line.Metrics.Length - colNo, tokenLength); var subLine = new HamlLine(subTag, subTagRule, metrics, line.Indent + "\t", isInline: true); ProcessInlineTags(subLine, result); } } result.Insert(0, line); }
public HamlUnknownNodeTypeException(Type nodeType, HamlSourceFileMetrics metrics) : this(nodeType, metrics, null) { }
public HamlNodeWalkerException(string hamlNodeType, HamlSourceFileMetrics metrics, Exception e) : base(string.Format("Exception occurred walking {0} HamlNode at {1}.", hamlNodeType, metrics), e) { }
public HamlParserUnknownRuleException(string ruleValue, HamlSourceFileMetrics metrics) : this(ruleValue, metrics, null) { }
private HamlParserUnknownRuleException(string ruleValue, HamlSourceFileMetrics metrics, Exception ex) : base(string.Format("Unknown rule '{0}' at {1}", ruleValue, metrics), ex) { }
public HamlNodeTextVariable(HamlSourceFileMetrics metrics, string content) : base(metrics, content) { }
public HamlInvalidChildNodeException(Type nodeType, Type childType, HamlSourceFileMetrics lineNo) : this(nodeType, childType, lineNo, null) { }
public HamlNodeTextLiteral(HamlSourceFileMetrics metrics, string content) : base(metrics, content) { }
public HamlNodeTagId(HamlSourceFileMetrics metrics, string tagId) : base(metrics, tagId) { }
private HamlUnknownNodeTypeException(Type nodeType, HamlSourceFileMetrics metrics, Exception ex) : base(string.Format("Unknown node type '{0}' at {1}", nodeType.FullName, metrics), ex) { }