// stateLeftDelim scans the left delimiter, which is known to be present.
321986
func stateLeftDelim(l *lexer) stateFn {
	l.seek(len(l.leftDelim))
	if l.peek() == '=' {
		// When the lexer encounters "{{=" it proceeds to the set delimiter
		// state which alters the left and right delimiters. This operation is
		// hidden from the parser and no tokens are emited.
		l.next()
		return stateSetDelim
	}
	l.emit(tokenLeftDelim)
	return stateTag
}
1022955
func LexLogical(l *Lexer) StateFn {

	//u.Debugf("in lexLogical: peek: %q  end? %v", l.PeekX(5), l.IsEnd())
	l.SkipWhiteSpaces()

	r := l.Peek()
	switch r {
	case ')':
		return nil
	default:
	}

	if l.IsEnd() {
		return nil
	}

	l.Push("LexLogical", LexLogical)
	return LexExpression(l)
}
340097
func (gp *GoPdf) SetLeftMargin(margin float64) {
	gp.UnitsToPointsVar(&margin)
	gp.margins.Left = margin
}
1265049
func (d *decoder) state() json.Delim {
	if len(d.parseState) == 0 {
		return 0
	}
	return d.parseState[len(d.parseState)-1]
}
64811
func (s *Set) Delims(left, right string) {
	s.leftDelim = left
	s.rightDelim = right
}
832117
func (st *State) SLALevel() (string, error) {
	model, err := st.Model()
	if err != nil {
		return "", errors.Trace(err)
	}
	return model.SLALevel(), nil
}
334353
func lexMapKeyEnd(lx *lexer) stateFn {
	r := lx.next()
	switch {
	case isWhitespace(r) || isNL(r):
		return lexSkip(lx, lexMapKeyEnd)
	case isKeySeparator(r):
		return lexSkip(lx, lexMapValue)
	}
	// We start the value here
	lx.backup()
	return lexMapValue
}
585884
func lexText(l *lexer) stateFn {
	for {
		if strings.HasPrefix(l.input[l.pos:], l.leftDelim) {
			if l.pos > l.start {
				l.emit(itemText)
			}
			return lexLeftDelim
		}
		if l.next() == eof {
			break
		}
	}
	// Correctly reached EOF.
	if l.pos > l.start {
		l.emit(itemText)
	}
	l.emit(itemEOF)
	return nil
}
847625
func LexDdlAlterColumn(l *Lexer) StateFn {

	l.SkipWhiteSpaces()
	r := l.Peek()

	//u.Debugf("LexDdlAlterColumn  r= '%v'", string(r))

	// Cover the logic and grouping
	switch r {
	case '-', '/': // comment?
		p := l.Peek()
		if p == '-' {
			l.Push("entryStateFn", l.clauseState())
			return LexInlineComment
		}
	case ')':
		return nil
	case ';':
		return nil
	case ',':
		l.Next()
		l.Emit(TokenComma)
		return l.clauseState()
	}

	word := strings.ToLower(l.PeekWord())
	//u.Debugf("looking for operator:  word=%s", word)
	switch word {
	case "change":
		l.ConsumeWord(word)
		l.Emit(TokenChange)
		return LexDdlAlterColumn
	case "add":
		l.ConsumeWord(word)
		l.Emit(TokenAdd)
		return LexDdlAlterColumn
	case "after":
		l.ConsumeWord(word)
		l.Emit(TokenAfter)
		return LexDdlAlterColumn
	case "first":
		l.ConsumeWord(word)
		l.Emit(TokenFirst)
		return LexDdlAlterColumn

	// Character set is end of ddl column
	case "character": // character set
		cs := strings.ToLower(l.PeekX(len("character set")))
		if cs == "character set" {
			l.ConsumeWord(cs)
			l.Emit(TokenCharacterSet)
			l.Push("LexDdlAlterColumn", l.clauseState())
			return nil
		}

	// Below here are Data Types
	case "text":
		l.ConsumeWord(word)
		l.Emit(TokenTypeText)
		return l.clauseState()
	case "bigint":
		l.ConsumeWord(word)
		l.Emit(TokenTypeBigInt)
		return l.clauseState()
	case "varchar":
		l.ConsumeWord(word)
		l.Emit(TokenTypeVarChar)
		l.Push("LexDdlAlterColumn", l.clauseState())
		l.Push("LexParenRight", LexParenRight)
		return LexListOfArgs

	default:
		r = l.Peek()
		if r == ',' {
			l.Emit(TokenComma)
			l.Push("LexDdlAlterColumn", l.clauseState())
			return LexExpressionOrIdentity
		}
		if l.isNextKeyword(word) {
			//u.Infof("found keyword? %v ", word)
			return nil
		}
	}
	//u.LogTracef(u.WARN, "hmmmmmmm")
	//u.Infof("LexDdlAlterColumn = '%v'", string(r))

	// ensure we don't get into a recursive death spiral here?
	if len(l.stack) < 100 {
		l.Push("LexDdlAlterColumn", l.clauseState())
	} else {
		u.Errorf("Gracefully refusing to add more LexDdlAlterColumn: ")
	}
	return LexExpressionOrIdentity
}
204381
func lexRightDelim(l *lexer) stateFn {
	l.pos += Pos(len(l.rightDelim))
	l.emit(itemRightDelim)
	return lexText
}
489267
func LexDdlTable(l *Lexer) StateFn {

	/*
		CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
		    (create_definition,...)
		    [table_options]
		    [partition_options]

		CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
		    [(create_definition,...)]
		    [table_options]
		    [partition_options]
		    [IGNORE | REPLACE]
		    [AS] query_expression

		CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
		    { LIKE old_tbl_name | (LIKE old_tbl_name) }

		CREATE TABLE `City` (
		  `ID` int(11) NOT NULL AUTO_INCREMENT,
		  `Name` char(35) NOT NULL DEFAULT '',
		  `CountryCode` char(3) NOT NULL DEFAULT '',
		  `District` char(20) NOT NULL DEFAULT '',
		  `Population` int(11) NOT NULL DEFAULT '0',
		  PRIMARY KEY (`ID`),
		  KEY `CountryCode` (`CountryCode`),
		  CONSTRAINT `city_ibfk_1` FOREIGN KEY (`CountryCode`)
		     REFERENCES `Country` (`Code`)
		) ENGINE=InnoDB AUTO_INCREMENT=4080 DEFAULT CHARSET=utf8
	*/
	l.SkipWhiteSpaces()
	r := l.Next()

	//u.Debugf("LexDdlTable  r= '%v'", string(r))

	// Cover the logic and grouping
	switch r {
	case '(':
		// Start of columns
		l.Emit(TokenLeftParenthesis)
		l.Push("LexDdlTableColumn", LexDdlTableColumn)
		return LexIdentifier
	case ')':
		// end of columns
		l.Emit(TokenRightParenthesis)
		return LexDdlTableStorage
	case '-', '/': // comment?
		p := l.Peek()
		if p == '-' {
			l.backup()
			l.Push("LexDdlTable", LexDdlTable)
			return LexInlineComment
		}
		u.Warnf("unhandled comment non inline ")
	case ';':
		l.backup()
		return nil
	}

	l.backup()
	word := strings.ToLower(l.PeekWord())
	//u.Debugf("looking table col start:  word=%s", word)
	r = l.Peek()
	if r == ',' {
		l.Emit(TokenComma)
		l.Push("LexDdlTable", l.clauseState())
		return LexExpressionOrIdentity
	}
	if l.isNextKeyword(word) {
		return nil
	}
	// ensure we don't get into a recursive death spiral here?
	if len(l.stack) < 10 {
		l.Push("LexDdlTable", LexDdlTable)
	} else {
		u.Errorf("Gracefully refusing to add more LexDdlTable: ")
	}
	return LexExpressionOrIdentity
}
903699
func FillLeft(s string, w int) string {
	return DefaultCondition.FillLeft(s, w)
}
1347550
func leftOf(s, delim string) string {
	if left, _, ok := twoFields(s, delim); ok {
		return strings.TrimSpace(left)
	}
	return ""
}
1089059
func leftFn(l *lexer, s string) delimFn {
	l.leftDelim = s
	return rightFn
}
1150393
func stateInString(s *Scanner, c int) int {
	if c == '"' {
		s.Step = stateEndValue
		return ScanContinue
	}
	if c == '\\' {
		s.Step = stateInStringEsc
		return ScanContinue
	}
	if c < 0x20 {
		return s.error(c, "in string literal")
	}
	return ScanContinue
}
837871
func StateShim(st *state.State, m *state.Model) stateShim {
	return stateShim{st, m}
}
1075245
func LexParenLeft(l *Lexer) StateFn {

	l.SkipWhiteSpaces()

	// first rune must be opening Parenthesis
	r := l.Next()
	//u.Debugf("LexParenLeft:  %v", string(r))
	if r != '(' {
		u.Errorf("bad LexParenLeft? %v", string(r))
		return l.errorToken("expression must begin with a paren: ( " + l.current())
	}
	l.Emit(TokenLeftParenthesis)
	//u.Infof("LexParenLeft:   %v", string(r))
	return nil // ascend
}