Skip to content

Commit

Permalink
Merge pull request #1753 from onflow/supun/rename-parser
Browse files Browse the repository at this point in the history
Rename `parser2` package to `parser`
  • Loading branch information
SupunS committed Jun 27, 2022
2 parents ac20214 + e2be571 commit 5a06fec
Show file tree
Hide file tree
Showing 50 changed files with 89 additions and 89 deletions.
4 changes: 2 additions & 2 deletions fuzz.go
Expand Up @@ -21,7 +21,7 @@ package cadence
import (
"unicode/utf8"

"github.com/onflow/cadence/runtime/parser2"
"github.com/onflow/cadence/runtime/parser"
"github.com/onflow/cadence/runtime/sema"
"github.com/onflow/cadence/runtime/tests/utils"
)
Expand All @@ -32,7 +32,7 @@ func Fuzz(data []byte) int {
return 0
}

program, err := parser2.ParseProgram(string(data), nil)
program, err := parser.ParseProgram(string(data), nil)

if err != nil {
return 0
Expand Down
2 changes: 1 addition & 1 deletion go.cap
Expand Up @@ -2,7 +2,7 @@ github.com/onflow/cadence ()

github.com/davecgh/go-spew/spew (file)
github.com/onflow/cadence/runtime/interpreter (runtime)
github.com/onflow/cadence/runtime/parser2 (file)
github.com/onflow/cadence/runtime/parser (file)
github.com/onflow/cadence/runtime/pretty (runtime)
github.com/opentracing/opentracing-go (network)
github.com/stretchr/testify/assert (runtime, file, network)
Expand Down
6 changes: 3 additions & 3 deletions runtime/ast/inspector_test.go
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/parser2"
"github.com/onflow/cadence/runtime/parser"
"github.com/onflow/cadence/runtime/tests/examples"
)

Expand All @@ -34,7 +34,7 @@ func TestInspector_Elements(t *testing.T) {

t.Parallel()

program, err := parser2.ParseProgram(examples.FungibleTokenContractInterface, nil)
program, err := parser.ParseProgram(examples.FungibleTokenContractInterface, nil)
require.NoError(t, err)

inspector := ast.NewInspector(program)
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestInspectorTypeFiltering(t *testing.T) {
}
`

program, err := parser2.ParseProgram(code, nil)
program, err := parser.ParseProgram(code, nil)
require.NoError(t, err)

inspector := ast.NewInspector(program)
Expand Down
4 changes: 2 additions & 2 deletions runtime/ast/string_test.go
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/stretchr/testify/assert"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/parser2"
"github.com/onflow/cadence/runtime/parser"
)

func TestQuoteString(t *testing.T) {
Expand Down Expand Up @@ -76,7 +76,7 @@ func TestQuoteString(t *testing.T) {

func TestStringQuick(t *testing.T) {
f := func(text string) bool {
res, errs := parser2.ParseExpression(ast.QuoteString(text), nil)
res, errs := parser.ParseExpression(ast.QuoteString(text), nil)
if len(errs) > 0 {
return false
}
Expand Down
4 changes: 2 additions & 2 deletions runtime/cmd/cmd.go
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/interpreter"
"github.com/onflow/cadence/runtime/parser2"
"github.com/onflow/cadence/runtime/parser"
"github.com/onflow/cadence/runtime/pretty"
"github.com/onflow/cadence/runtime/sema"
"github.com/onflow/cadence/runtime/stdlib"
Expand Down Expand Up @@ -62,7 +62,7 @@ func PrepareProgramFromFile(location common.StringLocation, codes map[common.Loc
func PrepareProgram(code string, location common.Location, codes map[common.Location]string) (*ast.Program, func(error)) {
must := mustClosure(location, codes)

program, err := parser2.ParseProgram(code, nil)
program, err := parser.ParseProgram(code, nil)
codes[location] = code
must(err)

Expand Down
6 changes: 3 additions & 3 deletions runtime/cmd/parse/main.go
Expand Up @@ -34,7 +34,7 @@ import (

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/parser2"
"github.com/onflow/cadence/runtime/parser"
"github.com/onflow/cadence/runtime/pretty"
)

Expand Down Expand Up @@ -175,7 +175,7 @@ func runPath(path string, bench bool) (res result, succeeded bool) {
}
}()

program, err = parser2.ParseProgram(code, nil)
program, err = parser.ParseProgram(code, nil)
if !bench {
res.Program = program
}
Expand All @@ -189,7 +189,7 @@ func runPath(path string, bench bool) (res result, succeeded bool) {

if bench {
benchRes := benchParse(func() (err error) {
_, err = parser2.ParseProgram(code, nil)
_, err = parser.ParseProgram(code, nil)
return
})
res.Bench = &benchResult{
Expand Down
4 changes: 2 additions & 2 deletions runtime/cmd/parse/main_wasm.go
Expand Up @@ -27,7 +27,7 @@ import (
"syscall/js"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/parser2"
"github.com/onflow/cadence/runtime/parser"
)

const globalFunctionNamePrefix = "CADENCE_PARSER"
Expand Down Expand Up @@ -68,7 +68,7 @@ func parse(code string) string {
}
}()

res.Program, res.Error = parser2.ParseProgram(code, nil)
res.Program, res.Error = parser.ParseProgram(code, nil)
}()

serialized, err := json.Marshal(res)
Expand Down
8 changes: 4 additions & 4 deletions runtime/convertValues_test.go
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/onflow/cadence"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/interpreter"
"github.com/onflow/cadence/runtime/parser2"
"github.com/onflow/cadence/runtime/parser"
"github.com/onflow/cadence/runtime/sema"
. "github.com/onflow/cadence/runtime/tests/utils"
)
Expand Down Expand Up @@ -1818,7 +1818,7 @@ func TestExportTypeValue(t *testing.T) {
pub struct S: SI {}
`
program, err := parser2.ParseProgram(code, nil)
program, err := parser.ParseProgram(code, nil)
require.NoError(t, err)

checker, err := sema.NewChecker(program, TestLocation, nil, false)
Expand Down Expand Up @@ -1909,7 +1909,7 @@ func TestExportCapabilityValue(t *testing.T) {
const code = `
pub struct S {}
`
program, err := parser2.ParseProgram(code, nil)
program, err := parser.ParseProgram(code, nil)
require.NoError(t, err)

checker, err := sema.NewChecker(program, TestLocation, nil, false)
Expand Down Expand Up @@ -2022,7 +2022,7 @@ func TestExportLinkValue(t *testing.T) {
const code = `
pub struct S {}
`
program, err := parser2.ParseProgram(code, nil)
program, err := parser.ParseProgram(code, nil)
require.NoError(t, err)

checker, err := sema.NewChecker(program, TestLocation, nil, false)
Expand Down
10 changes: 5 additions & 5 deletions runtime/literal.go
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/interpreter"
"github.com/onflow/cadence/runtime/parser2"
"github.com/onflow/cadence/runtime/parser"
"github.com/onflow/cadence/runtime/sema"
)

Expand All @@ -48,9 +48,9 @@ func ParseLiteral(
cadence.Value,
error,
) {
expression, errs := parser2.ParseExpression(literal, inter)
expression, errs := parser.ParseExpression(literal, inter)
if len(errs) > 0 {
return nil, parser2.Error{
return nil, parser.Error{
Code: literal,
Errors: errs,
}
Expand All @@ -71,9 +71,9 @@ func ParseLiteralArgumentList(
[]cadence.Value,
error,
) {
arguments, errs := parser2.ParseArgumentList(argumentList, inter)
arguments, errs := parser.ParseArgumentList(argumentList, inter)
if len(errs) > 0 {
return nil, parser2.Error{
return nil, parser.Error{
Errors: errs,
}
}
Expand Down
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions runtime/parser2/comment.go β†’ runtime/parser/comment.go
Expand Up @@ -16,13 +16,13 @@
* limitations under the License.
*/

package parser2
package parser

import (
"fmt"
"strings"

"github.com/onflow/cadence/runtime/parser2/lexer"
"github.com/onflow/cadence/runtime/parser/lexer"
)

const blockCommentStart = "/*"
Expand Down
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"encoding/hex"
Expand All @@ -27,7 +27,7 @@ import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/runtime/parser2/lexer"
"github.com/onflow/cadence/runtime/parser/lexer"
)

func parseDeclarations(p *parser, endTokenType lexer.TokenType) (declarations []ast.Declaration) {
Expand Down
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"fmt"
Expand Down
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"regexp"
Expand Down
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion runtime/parser2/errors.go β†’ runtime/parser/errors.go
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"fmt"
Expand Down
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"fmt"
Expand All @@ -27,7 +27,7 @@ import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/runtime/parser2/lexer"
"github.com/onflow/cadence/runtime/parser/lexer"
)

const exprBindingPowerGap = 10
Expand Down
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions runtime/parser2/function.go β†’ runtime/parser/function.go
Expand Up @@ -16,13 +16,13 @@
* limitations under the License.
*/

package parser2
package parser

import (
"fmt"

"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/parser2/lexer"
"github.com/onflow/cadence/runtime/parser/lexer"
)

func parseParameterList(p *parser) (parameterList *ast.ParameterList) {
Expand Down
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"github.com/onflow/cadence/runtime/errors"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"github.com/onflow/cadence/runtime/errors"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

const (
keywordIf = "if"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions runtime/parser2/parser.go β†’ runtime/parser/parser.go
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

package parser2
package parser

import (
"fmt"
Expand All @@ -26,7 +26,7 @@ import (
"github.com/onflow/cadence/runtime/ast"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/cadence/runtime/errors"
"github.com/onflow/cadence/runtime/parser2/lexer"
"github.com/onflow/cadence/runtime/parser/lexer"
)

// expressionDepthLimit is the limit of how deeply nested an expression can get
Expand Down

0 comments on commit 5a06fec

Please sign in to comment.