Skip to content

Parser Error for Reserved Keywords #1005

@ArquintL

Description

@ArquintL

While we should namespace Gobra's keywords in the midterm future (cf. #118), the parser should provide better error message for the time being.
E.g., the following bitLen function from the Go standard library (crypto/internal/fips140/bigmod) produces a "no viable alternative at input 'len :=' error message, which is fine. However, having (not even verifying!) the very same function in a larger file, produces the following error at a completely unrelated portion of the file

unexpected ==, expecting arguments
        assert reveal n.AnnouncedLen() == 0
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package test

func bitLen(n uint) int {
	len := 0
	// We assume, here and elsewhere, that comparison to zero is constant time
	// with respect to different non-zero values.
	for n != 0 {
		len++
		n >>= 1
	}
	return len
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions