Bug #1274

class names cannot begin with a digit

Added by Martha Greenberg over 3 years ago. Updated over 3 years ago.

Status:Closed Start date:
Priority:Normal Due date:
Assignee:James Turnbull % Done:

0%

Category:language
Target version:0.24.6
Affected Puppet version:0.24.4 Branch:
Keywords:
Votes: 0

Description

While a digit-only class name works, a class name that begins with one or more digits followed by a letter fails:

# cat test.pp
class 1foo {
 notice("test")
}
# puppet test.pp
Could not parse for environment development: Syntax error at 'foo' at /tmp/test.pp:1
# cat test1.pp
class 1 {
 notice("test")
}
# puppet test1.pp
# cat test2.pp
class foo1 {
 notice("test")
}
# puppet test2.pp
# cat test3.pp
class f1oo {
 notice("test")
}
# puppet test3.pp
# cat test4.pp
class 123foo {
 notice("test")
}
# puppet test4.pp
Could not parse for environment development: Syntax error at 'foo' at /tmp/test4.pp:1
#


Related issues

related to Puppet - Bug #3129: Problem using a number as as class name Accepted 01/30/2010
related to Puppet - Bug #10506: Naming rules are inconsistent Accepted 11/03/2011

History

Updated by Redmine Admin over 3 years ago

  • Status changed from 1 to Unreviewed

Updated by AJ Christensen over 3 years ago

  • Status changed from Unreviewed to Needs Decision
  • Assignee changed from Puppet Community to 228

Any comments on this one?

I’m of the opinion that “words” (class names) should always begin with a alphabetical character (non-numeric)

Updated by Luke Kanies over 3 years ago

  • Status changed from Needs Decision to Accepted
  • Assignee changed from 228 to Puppet Community

I guess I’d be willing to accept this as a patch, but I’m certainly never going to do the work.

It shouldn’t be too hard to update the lexer and its tests to make this happen.

Updated by James Turnbull over 3 years ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Assignee changed from Puppet Community to Luke Kanies
  • Affected Puppet version set to 0.24.4

I think this commit fixes this ticket – http://github.com/jamtur01/puppet/commit/5dd14ccb989cc5adc272bae65e1825c8a383e8f2.

It even includes an updated test – that even passes!

Luke – need you to confirm that I haven’t done something real bad. :)

Updated by James Turnbull over 3 years ago

  • Target version set to 0.24.6

Updated by Luke Kanies over 3 years ago

  • Status changed from In Topic Branch Pending Review to Ready For Checkin

Updated by Luke Kanies over 3 years ago

  • Assignee changed from Luke Kanies to James Turnbull

Updated by James Turnbull over 3 years ago

  • Status changed from Ready For Checkin to Closed

Pushed in commit:6676b6b in branch 0.24.x

Also available in: Atom PDF