Skip to content

Commit

Permalink
Merge pull request #2084 from influxdb/leading_underscores
Browse files Browse the repository at this point in the history
Allow leading underscores for IDENTs
  • Loading branch information
otoolep committed Mar 26, 2015
2 parents 0bcec78 + 4484589 commit 99494a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## Features
- [#2076](https://github.com/influxdb/influxdb/pull/2076): Seperate stdout and stderr output in init.d script

## Bugfixes
- [#2084](https://github.com/influxdb/influxdb/pull/2084): Allowing leading underscores in identifiers.

## v0.9.0-rc16 [2015-03-24]

Expand Down
5 changes: 3 additions & 2 deletions influxql/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ func (s *Scanner) Scan() (tok Token, pos Pos, lit string) {
ch0, pos := s.r.read()

// If we see whitespace then consume all contiguous whitespace.
// If we see a letter then consume as an ident or reserved word.
// If we see a letter, or certain acceptable special characters, then consume
// as an ident or reserved word.
if isWhitespace(ch0) {
return s.scanWhitespace()
} else if isLetter(ch0) {
} else if isLetter(ch0) || ch0 == '_' {
s.r.unread()
return s.scanIdent()
} else if isDigit(ch0) {
Expand Down
1 change: 1 addition & 0 deletions influxql/scanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func TestScanner_Scan(t *testing.T) {

// Identifiers
{s: `foo`, tok: influxql.IDENT, lit: `foo`},
{s: `_foo`, tok: influxql.IDENT, lit: `_foo`},
{s: `Zx12_3U_-`, tok: influxql.IDENT, lit: `Zx12_3U_`},
{s: `"foo".bar`, tok: influxql.IDENT, lit: `"foo".bar`},
{s: `"foo\\bar"`, tok: influxql.IDENT, lit: `"foo\bar"`},
Expand Down

0 comments on commit 99494a1

Please sign in to comment.