Skip to content

Commit

Permalink
refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
romanchechyotkin committed Oct 6, 2023
1 parent dbe9e23 commit ad47720
Show file tree
Hide file tree
Showing 35 changed files with 57 additions and 47 deletions.
3 changes: 2 additions & 1 deletion ast/array_literal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package ast
import (
"bytes"
"strings"
"uman/token"

"github.com/usamaroman/uman/token"
)

type ArrayLiteral struct {
Expand Down
2 changes: 1 addition & 1 deletion ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ast
import (
"bytes"

"uman/token"
"github.com/usamaroman/uman/token"
)

type Node interface {
Expand Down
3 changes: 2 additions & 1 deletion ast/ast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package ast
import (
"log"
"testing"
"uman/token"

"github.com/usamaroman/uman/token"
)

func TestAst(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion ast/block_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package ast

import (
"bytes"
"uman/token"

"github.com/usamaroman/uman/token"
)

type BlockStatement struct {
Expand Down
2 changes: 1 addition & 1 deletion ast/boolean_literal.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

import "uman/token"
import "github.com/usamaroman/uman/token"

type BooleanLiteral struct {
Token token.Token
Expand Down
3 changes: 2 additions & 1 deletion ast/call_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package ast
import (
"bytes"
"strings"
"uman/token"

"github.com/usamaroman/uman/token"
)

type CallExpression struct {
Expand Down
2 changes: 1 addition & 1 deletion ast/expression_stmt.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

import "uman/token"
import "github.com/usamaroman/uman/token"

type ExpressionStatement struct {
Token token.Token // first token
Expand Down
2 changes: 1 addition & 1 deletion ast/for_loop_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ast
import (
"bytes"

"uman/token"
"github.com/usamaroman/uman/token"
)

type ForLoopExpression struct {
Expand Down
3 changes: 2 additions & 1 deletion ast/function_literal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package ast
import (
"bytes"
"strings"
"uman/token"

"github.com/usamaroman/uman/token"
)

type FunctionLiteral struct {
Expand Down
2 changes: 1 addition & 1 deletion ast/if_else_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ast
import (
"bytes"

"uman/token"
"github.com/usamaroman/uman/token"
)

type IfExpression struct {
Expand Down
3 changes: 2 additions & 1 deletion ast/index_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package ast

import (
"bytes"
"uman/token"

"github.com/usamaroman/uman/token"
)

type IndexExpression struct {
Expand Down
3 changes: 2 additions & 1 deletion ast/infix_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package ast

import (
"bytes"
"uman/token"

"github.com/usamaroman/uman/token"
)

type InfixExpression struct {
Expand Down
2 changes: 1 addition & 1 deletion ast/integer_literal.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ast

import "uman/token"
import "github.com/usamaroman/uman/token"

type IntegerLiteral struct {
Token token.Token
Expand Down
3 changes: 2 additions & 1 deletion ast/prefix_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package ast

import (
"bytes"
"uman/token"

"github.com/usamaroman/uman/token"
)

type PrefixExpression struct {
Expand Down
3 changes: 2 additions & 1 deletion ast/return_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package ast

import (
"bytes"
"uman/token"

"github.com/usamaroman/uman/token"
)

// ReturnStatement returns variable from function
Expand Down
2 changes: 1 addition & 1 deletion ast/string_literal.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ast

import (
"uman/token"
"github.com/usamaroman/uman/token"
)

type StringLiteral struct {
Expand Down
3 changes: 2 additions & 1 deletion ast/variable_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package ast

import (
"bytes"
"uman/token"

"github.com/usamaroman/uman/token"
)

// VariableStatement variable creates using :
Expand Down
4 changes: 1 addition & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import (
"log"
"os"

"uman/repl"
"github.com/usamaroman/uman/repl"
)

func main() {
// TODO: реализовать переприсваивание infix Fn for =

args := os.Args
switch len(args) {
case 1:
Expand Down
2 changes: 1 addition & 1 deletion evaluator/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package evaluator
import (
"fmt"

"uman/object"
"github.com/usamaroman/uman/object"
)

var builtins = map[string]*object.Builtin{
Expand Down
6 changes: 3 additions & 3 deletions evaluator/evaluator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package evaluator
import (
"fmt"

"uman/ast"
"uman/object"
"uman/token"
"github.com/usamaroman/uman/ast"
"github.com/usamaroman/uman/object"
"github.com/usamaroman/uman/token"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions evaluator/evaluator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package evaluator

import (
"testing"
"uman/object"
"uman/parser"

"github.com/usamaroman/uman/object"
"github.com/usamaroman/uman/parser"
)

func testEval(input string) object.Object {
Expand Down
3 changes: 0 additions & 3 deletions go.mod

This file was deleted.

2 changes: 1 addition & 1 deletion lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package lexer
import (
"unicode"

"uman/token"
"github.com/usamaroman/uman/token"
)

type Lexer struct {
Expand Down
2 changes: 1 addition & 1 deletion lexer/lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package lexer
import (
"testing"

"uman/token"
"github.com/usamaroman/uman/token"
)

func TestNextToken(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion object/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"strings"

"uman/ast"
"github.com/usamaroman/uman/ast"
)

type Function struct {
Expand Down
3 changes: 2 additions & 1 deletion parser/array_literal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package parser

import (
"testing"
"uman/ast"

"github.com/usamaroman/uman/ast"
)

func TestParsingArrayLiterals(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion parser/call_expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package parser

import (
"testing"
"uman/ast"

"github.com/usamaroman/uman/ast"
)

func TestCallExpressionParsing(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion parser/expression_stmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"testing"

"uman/ast"
"github.com/usamaroman/uman/ast"
)

func TestIdentifierExpression(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion parser/for_loop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package parser
import (
"testing"

"uman/ast"
"github.com/usamaroman/uman/ast"
)

func TestForLoopExpression(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion parser/function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package parser

import (
"testing"
"uman/ast"

"github.com/usamaroman/uman/ast"
)

func TestFunctionExpression(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion parser/if_expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package parser
import (
"testing"

"uman/ast"
"github.com/usamaroman/uman/ast"
)

func TestIfExpression(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion parser/index_expression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package parser

import (
"testing"
"uman/ast"

"github.com/usamaroman/uman/ast"
)

func TestParsingIndexExpressions(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"strconv"

"uman/ast"
"uman/lexer"
"uman/token"
"github.com/usamaroman/uman/ast"
"github.com/usamaroman/uman/lexer"
"github.com/usamaroman/uman/token"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions parser/variable_stmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package parser
import (
"testing"

"uman/ast"
"uman/token"
"github.com/usamaroman/uman/ast"
"github.com/usamaroman/uman/token"
)

func TestVariableStatements(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions repl/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"os"
"strings"

"uman/evaluator"
"uman/object"
"uman/parser"
"github.com/usamaroman/uman/evaluator"
"github.com/usamaroman/uman/object"
"github.com/usamaroman/uman/parser"
)

var ErrWrongExtension = errors.New("wrong file extension")
Expand Down

0 comments on commit ad47720

Please sign in to comment.