func lexInsideAction(l *lexer) stateFn {
	// Either number, quoted string, or identifier.
	// Spaces separate arguments; runs of spaces turn into itemSpace.
	// Pipe symbols separate and are emitted.
	delim, _ := l.atRightDelim()
	if delim {
		if l.parenDepth == 0 {
			return lexRightDelim
		}
		return l.errorf("unclosed left paren")
	}
	switch r := l.next(); {
	case r == eof || isEndOfLine(r):
		return l.errorf("unclosed action")
	case isSpace(r):
		l.backup() // Put space back in case we have " -}}".
		return lexSpace
	case r == '=':
		l.emit(itemAssign)
	case r == ':':
		if l.next() != '=' {
			return l.errorf("expected :=")
		}
		l.emit(itemDeclare)
	case r == '|':
		l.emit(itemPipe)
	case r == '"':
		return lexQuote
	case r == '`':
		return lexRawQuote
	case r == '$':
		return lexVariable
	case r == '\'':
		return lexChar
	case r == '.':
		// special look-ahead for ".field" so we don't break l.backup().
		if l.pos < Pos(len(l.input)) {
			r := l.input[l.pos]
			if r < '0' || '9' < r {
				return lexField
			}
		}
		fallthrough // '.' can start a number.
	case r == '+' || r == '-' || ('0' <= r && r <= '9'):
		l.backup()
		return lexNumber
	case isAlphaNumeric(r):
		l.backup()
		return lexIdentifier
	case r == '(':
		l.emit(itemLeftParen)
		l.parenDepth++
	case r == ')':
		l.emit(itemRightParen)
		l.parenDepth--
		if l.parenDepth < 0 {
			return l.errorf("unexpected right paren %#U", r)
		}
	case r <= unicode.MaxASCII && unicode.IsPrint(r):
		l.emit(itemChar)
	default:
		return l.errorf("unrecognized character in action: %#U", r)
	}
	return lexInsideAction
}
// lexInsideAction scans the elements inside action delimiters.
lexInsideAction scans the elements inside action delimiters.
// lexInsideAction scans the elements inside action delimiters .
func lexInsideAction(l *lexer) stateFn {
	delim, _ := l.atRightDelim()
	if delim {
		if l.parenDepth == 0 {
			return lexRightDelim
		}
		return l.errorf("unclosed left paren")
	}
	switch r := l.next(); {
	case r == eof || isEndOfLine(r):
		return l.errorf("unclosed action")
	case isSpace(r):
		l.backup() 
		return lexSpace
	case r == '=':
		l.emit(itemAssign)
	case r == ':':
		if l.next() != '=' {
			return l.errorf("expected :=")
		}
		l.emit(itemDeclare)
	case r == '|':
		l.emit(itemPipe)
	case r == '"':
		return lexQuote
	case r == '`':
		return lexRawQuote
	case r == '$':
		return lexVariable
	case r == '\'':
		return lexChar
	case r == '.':
		if l.pos < Pos(len(l.input)) {
			r := l.input[l.pos]
			if r < '0' || '9' < r {
				return lexField
			}
		}
		fallthrough 
	case r == '+' || r == '-' || ('0' <= r && r <= '9'):
		l.backup()
		return lexNumber
	case isAlphaNumeric(r):
		l.backup()
		return lexIdentifier
	case r == '(':
		l.emit(itemLeftParen)
		l.parenDepth++
	case r == ')':
		l.emit(itemRightParen)
		l.parenDepth--
		if l.parenDepth < 0 {
			return l.errorf("unexpected right paren %#U", r)
		}
	case r <= unicode.MaxASCII && unicode.IsPrint(r):
		l.emit(itemChar)
	default:
		return l.errorf("unrecognized character in action: %#U", r)
	}
	return lexInsideAction
}
func lexInsideAction ( l * lexer ) stateFn { delim , _ := l . atRightDelim ( ) if delim { if l . parenDepth == 0 { return lexRightDelim } return l . errorf ( " " ) } switch r := l . next ( ) ; { case r == eof || isEndOfLine ( r ) : return l . errorf ( " " ) case isSpace ( r ) : l . backup ( ) return lexSpace case r == '=' : l . emit ( itemAssign ) case r == ':' : if l . next ( ) != '=' { return l . errorf ( " " ) } l . emit ( itemDeclare ) case r == '|' : l . emit ( itemPipe ) case r == '"' : return lexQuote case r == '`' : return lexRawQuote case r == '$' : return lexVariable case r == '\'' : return lexChar case r == '.' : if l . pos < Pos ( len ( l . input ) ) { r := l . input [ l . pos ] if r < '0' || '9' < r { return lexField } } fallthrough case r == '+' || r == '-' || ( '0' <= r && r <= '9' ) : l . backup ( ) return lexNumber case isAlphaNumeric ( r ) : l . backup ( ) return lexIdentifier case r == '(' : l . emit ( itemLeftParen ) l . parenDepth ++ case r == ')' : l . emit ( itemRightParen ) l . parenDepth -- if l . parenDepth < 0 { return l . errorf ( " " , r ) } case r <= unicode . MaxASCII && unicode . IsPrint ( r ) : l . emit ( itemChar ) default : return l . errorf ( " " , r ) } return lexInsideAction }
lexInsideAction scans the elements inside action delimiters.
lexInsideAction scans the elements inside action delimiters .
// Either number, quoted string, or identifier. // Spaces separate arguments; runs of spaces turn into itemSpace. // Pipe symbols separate and are emitted. // Put space back in case we have " -}}". // special look-ahead for ".field" so we don't break l.backup(). // '.' can start a number.