diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-09-24 01:17:27 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-09-24 13:40:59 +0900 |
commit | a8ed73f786fa9dd28965e4bf915022eb4a90bbba (patch) | |
tree | b760670fb2eda9a06acafbab3e7df56e4f4d7bf4 /spec | |
parent | Remove --debug option from compile command (diff) | |
download | tre-a8ed73f786fa9dd28965e4bf915022eb4a90bbba.tar.gz tre-a8ed73f786fa9dd28965e4bf915022eb4a90bbba.tar.xz |
Disallow upper cases in an identifier
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec.go | 2 | ||||
-rw-r--r-- | spec/spec_test.go | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/spec/spec.go b/spec/spec.go index 2360201..3d46269 100644 --- a/spec/spec.go +++ b/spec/spec.go @@ -101,7 +101,7 @@ func (m LexModeName) validate() error { return nil } -const idPattern = `^[A-Za-z](_?[0-9A-Za-z]+)*$` +const idPattern = `^[a-z](_?[0-9a-z]+)*$` var idRE = regexp.MustCompile(idPattern) diff --git a/spec/spec_test.go b/spec/spec_test.go index 54d7b7d..e0e920e 100644 --- a/spec/spec_test.go +++ b/spec/spec_test.go @@ -22,6 +22,14 @@ var idTests = []struct { id: "f_o_o", }, { + id: "Foo", + invalid: true, + }, + { + id: "foo_Bar", + invalid: true, + }, + { id: "2foo", invalid: true, }, |