private Token mixinInject() { var matcher = _jadeScanner.getMatcherForPattern("^\\+([-\\w]+)"); if (matcher.Count > 0 && matcher[0].Success && matcher[0].Groups.Count > 0) { MixinInject tok = new MixinInject(matcher[0].Groups[1].Value, lineno); consume(matcher[0].Length); matcher = _jadeScanner.getMatcherForPattern("^ *\\((.*?)\\)"); if (matcher.Count > 0 && matcher[0].Success && matcher[0].Groups.Count > 0) { // verify group does not contain attributes var attributeRegex = new Regex("^ *[-\\w]+ *="); var attributeMatcher = attributeRegex.Matches(matcher[0].Groups[1].Value); if (attributeMatcher.Count < 1) { tok.setArguments(matcher[0].Groups[1].Value); consume(matcher[0].Length); } } return(tok); } return(null); }
private Node parseMixinInject() { Token token = expect(typeof(MixinInject)); MixinInject mixinInjectToken = (MixinInject)token; MixinInjectNode node = new MixinInjectNode(); node.setName(mixinInjectToken.getValue()); node.setLineNumber(mixinInjectToken.getLineNumber()); node.setFileName(filename); if (StringUtils.isNotBlank(mixinInjectToken.getArguments())) { node.setArguments(mixinInjectToken.getArguments()); } while (true) { Token incomingToken = peek(); if (incomingToken is CssId) { Token tok = nextToken(); node.addAttribute("id", tok.getValue()); } else if (incomingToken is CssClass) { Token tok = nextToken(); node.addAttribute("class", tok.getValue()); } else if (incomingToken is Attribute) { Attribute tok = (Attribute)nextToken(); node.addAttributes(tok.getAttributes()); } else { break; } } if (peek() is Text) { node.setBlock(parseText()); } else if (peek() is Indent) { node.setBlock(block()); } return(node); }