config/lang: remove unused code

This commit is contained in:
Mitchell Hashimoto 2015-01-14 10:11:29 -08:00
parent 92af4801a1
commit dd456871e9
1 changed files with 7 additions and 8 deletions

View File

@ -53,10 +53,13 @@ const (
// The parser calls this method to get each new token. // The parser calls this method to get each new token.
func (x *parserLex) Lex(yylval *parserSymType) int { func (x *parserLex) Lex(yylval *parserSymType) int {
// We always start in literal mode, since programs don't start
// in an interpolation. ex. "foo ${bar}" vs "bar" (and assuming interp.)
if x.mode == parserModeInvalid { if x.mode == parserModeInvalid {
x.mode = parserModeLiteral x.mode = parserModeLiteral
} }
// Defer an update to set the proper column/line we read the next token.
defer func() { defer func() {
if yylval.token != nil && yylval.token.Pos.Column == 0 { if yylval.token != nil && yylval.token.Pos.Column == 0 {
yylval.token.Pos = *x.astPos yylval.token.Pos = *x.astPos
@ -127,8 +130,8 @@ func (x *parserLex) lexModeInterpolation(yylval *parserSymType) int {
continue continue
} }
// If we see a double quote and we're in an interpolation, then // If we see a double quote then we're lexing a string since
// we are lexing a string. // we're in interpolation mode.
if c == '"' { if c == '"' {
result, terminated := x.lexString(yylval, true) result, terminated := x.lexString(yylval, true)
if !terminated { if !terminated {
@ -154,6 +157,8 @@ func (x *parserLex) lexModeInterpolation(yylval *parserSymType) int {
switch c { switch c {
case '}': case '}':
// '}' means we ended the interpolation. Pop back into
// literal mode and reduce our interpolation depth.
x.interpolationDepth-- x.interpolationDepth--
x.mode = parserModeLiteral x.mode = parserModeLiteral
return PROGRAM_BRACKET_RIGHT return PROGRAM_BRACKET_RIGHT
@ -291,12 +296,6 @@ func (x *parserLex) lexString(yylval *parserSymType, quoted bool) (int, bool) {
} }
} }
// If we hit a '}' and we're in a program, then end it.
if c == '}' && x.interpolationDepth > 0 {
x.backup()
break
}
// If we hit a dollar sign, then check if we're starting // If we hit a dollar sign, then check if we're starting
// another interpolation. If so, then we're done. // another interpolation. If so, then we're done.
if c == '$' { if c == '$' {