Skip to content

Commit

Permalink
Allow class keyword as identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
5nord committed Oct 25, 2024
1 parent 3864ad3 commit 1f34a6d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ttcn3/syntax/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ func (p *parser) parseRedirect(x Expr) *RedirectExpr {

func (p *parser) parseName() *Ident {
switch p.tok {
case IDENT, ADDRESS, CONTROL:
case IDENT, ADDRESS, CONTROL, CLASS:
id := &Ident{Tok: p.consume(), IsName: true}
p.names[id.String()] = true
return id
Expand All @@ -1015,7 +1015,7 @@ func (p *parser) parseIdent() *Ident {
switch p.tok {
case UNIVERSAL:
return p.parseUniversalCharstring()
case IDENT, ADDRESS, ALIVE, CHARSTRING, CONTROL, TO, FROM, CREATE:
case IDENT, ADDRESS, ALIVE, CHARSTRING, CONTROL, TO, FROM, CREATE, CLASS:
return p.make_use(p.consume())
default:
p.expect(IDENT) // use expect() error handling
Expand Down
1 change: 1 addition & 0 deletions ttcn3/syntax/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func TestExprs(t *testing.T) {
{pass, `{[0] := 1, [1] := 2 }`},
{pass, `x[i][j] := 1, y[k] := 2 }`},
{pass, `{(1+2)*3, a.f()}`},
{pass, `x.class := 23`},
{pass, `{-,-}`},
{pass, `(1,*,?,-,2)`},
{pass, `t length(5..23)`},
Expand Down

0 comments on commit 1f34a6d

Please sign in to comment.