// lexCss scans the body of the {css} command into an itemText.
// This is required because css classes are unquoted and may have hyphens (and
// thus are not recognized as idents).
// itemCss has already been emitted
497466
func lexCss(l *lexer) stateFn {
	l.next()
	l.ignore()
	for l.next() != '}' {
	}
	l.backup()
	l.emit(itemText)
	l.next()
	if l.doubleDelim && l.next() != '}' {
		return l.errorf("expected double closing braces in tag")
	}
	l.emit(itemRightDelim)
	return lexText
}
546357
func (z *Lexer) Lexeme() []byte {
	return z.buf[z.start:z.pos]
}
655619
func lexQuotedString(lx *lexer) stateFn {
	r := lx.next()
	switch {
	case r == sqStringEnd:
		lx.backup()
		lx.emit(itemString)
		lx.next()
		lx.ignore()
		return lx.pop()
	case r == eof:
		if lx.pos > lx.start {
			return lx.errorf("Unexpected EOF.")
		}
		lx.emit(itemEOF)
		return nil
	}
	return lexQuotedString
}
1046387
func (ns *Namespace) ToCSS(args ...interface{}) (resource.Resource, error) {
	var (
		r          resource.Resource
		m          map[string]interface{}
		targetPath string
		err        error
		ok         bool
	)

	r, targetPath, ok = ns.resolveIfFirstArgIsString(args)

	if !ok {
		r, m, err = ns.resolveArgs(args)
		if err != nil {
			return nil, err
		}
	}

	var options scss.Options
	if targetPath != "" {
		options.TargetPath = targetPath
	} else if m != nil {
		options, err = scss.DecodeOptions(m)
		if err != nil {
			return nil, err
		}
	}

	return ns.scssClient.ToCSS(r, options)
}
897036
func lexString(lx *lexer) stateFn {
	r := lx.next()
	switch {
	case r == '\\':
		lx.addCurrentStringPart(1)
		return lexStringEscape
	// Termination of non-quoted strings
	case isNL(r) || r == eof || r == optValTerm ||
		r == arrayValTerm || r == arrayEnd || r == mapEnd ||
		isWhitespace(r):

		lx.backup()
		if lx.hasEscapedParts() {
			lx.emitString()
		} else if lx.isBool() {
			lx.emit(itemBool)
		} else if lx.isVariable() {
			lx.emit(itemVariable)
		} else {
			lx.emitString()
		}
		return lx.pop()
	case r == sqStringEnd:
		lx.backup()
		lx.emitString()
		lx.next()
		lx.ignore()
		return lx.pop()
	}
	return lexString
}
1233495
func lex(name, input, left, right string) *lexer {
	if left == "" {
		left = leftDelim
	}
	if right == "" {
		right = rightDelim
	}
	l := &lexer{
		name:       name,
		input:      input,
		leftDelim:  left,
		rightDelim: right,
		items:      make(chan item),
	}
	go l.run()
	return l
}
753705
func lexText(l *lexer) stateFn {
	for {
		if i := strings.IndexByte(l.input[l.pos:], l.leftDelim[0]); i == -1 {
			l.pos = Pos(len(l.input))
			break
		} else {
			l.pos += Pos(i)
			if strings.HasPrefix(l.input[l.pos:], l.leftDelim) {
				if l.pos > l.start {
					l.emit(itemText)
				}
				return lexLeftDelim
			}
			if strings.HasPrefix(l.input[l.pos:], leftComment) {
				if l.pos > l.start {
					l.emit(itemText)
				}
				return lexComment
			}
		}
		if l.next() == eof {
			break
		}
	}
	// Correctly reached EOF.
	if l.pos > l.start {
		l.emit(itemText)
	}
	l.emit(itemEOF)
	return nil
}
5044
func lexString(lx *lexer) stateFn {
	r := lx.next()
	//u.Infof("lexString  r = %v", string(r))
	switch {
	case r == '\\':
		return lexStringEscape
	// Termination of non-quoted strings
	case lx.isEnd(lx, r):
		lx.backup()
		if lx.isBool() {
			lx.emit(itemBool)
		} else {
			lx.emit(itemString)
		}
		return lx.pop()
	case r == sqStringEnd:
		lx.backup()
		lx.emit(itemString)
		lx.next()
		lx.ignore()
		return lx.pop()
	}
	return lexString
}
506777
func lexRightDelim(l *lexer) stateFn {
	l.pos += Pos(len(l.rightDelim))
	l.emit(itemRightDelim)
	if l.peek() == '\\' {
		l.pos++
		l.emit(itemElideNewline)
	}
	return lexText
}
359282
func lexCommentStart(lx *lexer) stateFn {
	lx.ignore()
	lx.emit(itemCommentStart)
	return lexComment
}
1237710
func (l *lexer) emit(t itemType) {
	l.items <- item{t, l.start, l.input[l.start:l.pos], l.line, l.depth}
	// Some items contain text internally. If so, count their newlines.
	switch t {
	// case itemText, itemRawString, itemLeftDelim, itemRightDelim:
	case itemText:
		l.line += strings.Count(l.input[l.start:l.pos], "\n")
	}
	l.start = l.pos
}
1183868
func maybeEmitText(l *lexer, backup int) {
	if l.pos-ast.Pos(backup) > l.start {
		l.pos -= ast.Pos(backup)
		if allSpaceWithNewline(l.input[l.start:l.pos]) {
			l.ignore()
		} else {
			l.emit(itemText)
		}
		l.pos += ast.Pos(backup)
	}
}
65037
func lexField(l *lexer) stateFn {

	if l.atTerminator() {
		// Nothing interesting follows -> "." or "$".
		l.emit(itemIdentifier)
		return lexInsideAction
	}

	var r rune
	for {
		r = l.next()
		if !isAlphaNumeric(r) {
			l.backup()
			break
		}
	}
	if !l.atTerminator() {
		return l.errorf("bad character %#U", r)
	}
	l.emit(itemField)
	return lexInsideAction
}
204381
func lexRightDelim(l *lexer) stateFn {
	l.pos += Pos(len(l.rightDelim))
	l.emit(itemRightDelim)
	return lexText
}
403023
func lexQuote(l *lexer) stateFn {
Loop:
	for {
		switch l.next() {
		case '\\':
			if r := l.next(); r != eof && r != '\n' {
				break
			}
			fallthrough
		case eof, '\n':
			return l.errorf("unterminated quoted string")
		case '"':
			break Loop
		}
	}
	l.emit(itemString)
	return lexInsideAction
}
992615
func lexMapKey(lx *lexer) stateFn {
	r := lx.peek()
	if isWhitespace(r) || isNL(r) || isKeySeparator(r) {
		lx.emit(itemKey)
		return lexMapKeyEnd
	}
	lx.next()
	return lexMapKey
}
1153872
func (c *CSS) SetStyleSheetText(styleSheetId string, text string) (string, error) {
	var v CSSSetStyleSheetTextParams
	v.StyleSheetId = styleSheetId
	v.Text = text
	return c.SetStyleSheetTextWithParams(&v)
}